-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Fix Compiling with Clang for CMake #1272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -187,20 +187,35 @@ endif() | |
# Only useful if building in-tree, versus using it from an installation. | ||
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) | ||
|
||
# Might be missing some, but this list is somewhat comprehensive | ||
target_compile_features(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC} | ||
cxx_std_11 | ||
cxx_nullptr | ||
cxx_lambdas | ||
cxx_override | ||
cxx_defaulted_functions | ||
cxx_attribute_deprecated | ||
cxx_auto_type | ||
cxx_decltype | ||
cxx_deleted_functions | ||
cxx_range_for | ||
cxx_sizeof_member | ||
) | ||
# Determines the C++ compiler executable name | ||
macro (DETERMINE_CXX_COMPILER_EXECUTABLE_NAME out_Name) | ||
set(_outStr ) | ||
string(REGEX MATCH "[^/\\]*$" _outStr ${CMAKE_CXX_COMPILER}) | ||
string(REGEX MATCH "[^\.]+" _outStr ${_outStr}) | ||
set(${out_Name} ${_outStr}) | ||
endmacro() | ||
|
||
# Determine the name of the C++ compiler executable | ||
set(_CXX_EXECUTABLE_NAME ) | ||
DETERMINE_CXX_COMPILER_EXECUTABLE_NAME(_CXX_EXECUTABLE_NAME) | ||
|
||
# Do not define the target compile features if using clang as clang doesn't provide them. | ||
if (NOT _CXX_EXECUTABLE_NAME MATCHES "clang") | ||
# Might be missing some, but this list is somewhat comprehensive | ||
target_compile_features(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC} | ||
cxx_std_11 | ||
cxx_nullptr | ||
cxx_lambdas | ||
cxx_override | ||
cxx_defaulted_functions | ||
cxx_attribute_deprecated | ||
cxx_auto_type | ||
cxx_decltype | ||
cxx_deleted_functions | ||
cxx_range_for | ||
cxx_sizeof_member | ||
) | ||
Comment on lines
+205
to
+217
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Anyway I don't see why using In my opinion the low level compile features should be simply dropped. Even CMake's documentation recommends against their use: https://cmake.org/cmake/help/latest/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html#low-level-individual-compile-features cc @sum01 |
||
endif() | ||
|
||
target_include_directories(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC} | ||
$<BUILD_INTERFACE:${_httplib_build_includedir}> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed? Can't you just do