-
Notifications
You must be signed in to change notification settings - Fork 261
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
cmake: Check for C++-17 and conditionally enable it #188
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 |
---|---|---|
|
@@ -143,11 +143,19 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") | |
endif() | ||
|
||
set_target_properties(openxr_loader PROPERTIES SOVERSION "${MAJOR}" VERSION "${MAJOR}.${MINOR}.${PATCH}") | ||
target_link_libraries( | ||
openxr_loader | ||
PRIVATE stdc++fs | ||
PUBLIC m | ||
) | ||
|
||
if(HAVE_FLAG_STD_CXX17) | ||
target_link_libraries( | ||
openxr_loader | ||
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. So this could be split into two |
||
PUBLIC m | ||
) | ||
else() | ||
target_link_libraries( | ||
openxr_loader | ||
PRIVATE stdc++fs | ||
PUBLIC m | ||
) | ||
endif() | ||
|
||
add_custom_target( | ||
libopenxr_loader.so.${MAJOR}.${MINOR} ALL | ||
|
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.
I think the best way to do this that I've found is to search
CMAKE_CXX_COMPILE_FEATURES
forcxx_std_17
:This currently will not behave as desired on MSVC.
This change could be rebased on top of #192 - it's no longer needed to make it build on gcc 9.3.0 (I hope!) but it would still be worth considering an "opportunistic" upgrade to C++17.