1
0
Fork 0
mirror of https://github.com/Neargye/magic_enum.git synced 2026-01-10 23:44:29 +00:00

clean-up cmake

This commit is contained in:
terik23 2019-05-26 14:37:16 +05:00
parent ec40e17aa2
commit 7673a7c696
2 changed files with 16 additions and 14 deletions

View file

@ -2,8 +2,6 @@
set(SOURCES test.cpp)
set(OPTIONS "")
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(OPTIONS /W4 /WX)
check_cxx_compiler_flag(/permissive HAS_PERMISSIVE_FLAG)
@ -22,7 +20,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
check_cxx_compiler_flag(-std=c++20 HAS_CPP20_FLAG)
endif()
function(make_target target std)
function(make_test target std)
add_executable(${target} ${SOURCES})
target_compile_options(${target} PRIVATE ${OPTIONS})
target_include_directories(${target} PRIVATE 3rdparty/Catch2)
@ -34,14 +32,13 @@ function(make_target target std)
target_compile_options(${target} PRIVATE -std=${std})
endif()
endif()
add_test(NAME ${target} COMMAND ${target})
endfunction()
if(HAS_CPP17_FLAG)
make_target(${CMAKE_PROJECT_NAME}-cpp17.t c++17)
add_test(NAME ${CMAKE_PROJECT_NAME}-cpp17.t COMMAND ${CMAKE_PROJECT_NAME}-cpp17.t)
make_test(${CMAKE_PROJECT_NAME}-cpp17.t c++17)
endif()
if(HAS_CPPLATEST_FLAG)
make_target(${CMAKE_PROJECT_NAME}-cpplatest.t c++latest)
add_test(NAME ${CMAKE_PROJECT_NAME}-cpplatest.t COMMAND ${CMAKE_PROJECT_NAME}-cpplatest.t)
make_test(${CMAKE_PROJECT_NAME}-cpplatest.t c++latest)
endif()