mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Set CMake C++ standard (#3688)
Instead of setting `-std` compiler flag directly, set the `CMAKE_CXX_STANDARD` variable. This lets CMake know the required C++ standard and evaluate the final compiler flag correctly, taking into account compile features set by `target_compile_features()`. This change preserves the existing behavior, where compiler extensions are disabled for other targets than Cygwin.
This commit is contained in:
parent
096f94d3d1
commit
98204b17a6
1 changed files with 3 additions and 2 deletions
|
@ -6,7 +6,8 @@ include (CheckCXXCompilerFlag)
|
|||
CHECK_CXX_COMPILER_FLAG("-std=c++17" _HAS_CXX17)
|
||||
|
||||
if (_HAS_CXX17)
|
||||
set (_CXX14_FLAGS "-std=c++17")
|
||||
set (CMAKE_CXX_STANDARD 17)
|
||||
set (CMAKE_CXX_EXTENSIONS OFF)
|
||||
else (_HAS_CXX17)
|
||||
message (FATAL_ERROR "C++17 support missing. Try upgrading your C++ compiler. If you have a good reason for using an outdated compiler, please let us know at support@gothenburgbitfactory.org.")
|
||||
endif (_HAS_CXX17)
|
||||
|
@ -32,7 +33,7 @@ elseif (${CMAKE_SYSTEM_NAME} STREQUAL "GNU")
|
|||
set (GNUHURD true)
|
||||
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "CYGWIN")
|
||||
set (CYGWIN true)
|
||||
set (_CXX14_FLAGS "-std=gnu++17")
|
||||
set (CMAKE_CXX_EXTENSIONS ON)
|
||||
else (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
set (UNKNOWN true)
|
||||
endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue