mirror of
https://github.com/Neargye/magic_enum.git
synced 2026-01-09 23:34:23 +00:00
update cmake
This commit is contained in:
parent
91b36336cb
commit
a2bb347f05
3 changed files with 11 additions and 20 deletions
|
|
@ -1,27 +1,16 @@
|
|||
include(CheckCXXCompilerFlag)
|
||||
|
||||
if((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
|
||||
check_cxx_compiler_flag(-std=c++17 HAS_CPP17_FLAG)
|
||||
if(!HAS_CPP17_FLAG)
|
||||
MESSAGE(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++17 support.")
|
||||
endif()
|
||||
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
set(OPTIONS -Wall -Wextra -pedantic-errors -Werror -std=c++17)
|
||||
set(OPTIONS -Wall -Wextra -pedantic-errors -Werror)
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
check_cxx_compiler_flag(/std:c++17 HAS_CPP17_FLAG)
|
||||
if(!HAS_CPP17_FLAG)
|
||||
MESSAGE(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++17 support.")
|
||||
endif()
|
||||
|
||||
set(OPTIONS /W4 /WX /std:c++17)
|
||||
set(OPTIONS /W4 /WX)
|
||||
if(HAS_PERMISSIVE_FLAG)
|
||||
set(OPTIONS ${OPTIONS} /permissive-)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_executable(example
|
||||
example.cpp
|
||||
${CMAKE_SOURCE_DIR}/include/${CMAKE_PROJECT_NAME}.hpp)
|
||||
add_executable(example example.cpp)
|
||||
set_target_properties(example PROPERTIES CXX_EXTENSIONS OFF)
|
||||
target_compile_features(example PRIVATE cxx_std_17)
|
||||
target_compile_options(example PRIVATE ${OPTIONS})
|
||||
target_link_libraries(example PRIVATE ${CMAKE_PROJECT_NAME})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue