Skip to content

Commit

Permalink
CMake: build test.cpp in C++17 and C++20 modes
Browse files Browse the repository at this point in the history
ChangeLog:

	* CMakeLists.txt:
  • Loading branch information
mattkretz committed Sep 27, 2024
1 parent 86fcb95 commit 66858d6
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ set(GCC_WARNINGS ${CLANG_WARNINGS})

if(MSVC)
set(PROJECT_WARNINGS_CXX ${MSVC_WARNINGS})
target_compile_options(
vir-simd INTERFACE $<$<COMPILE_LANGUAGE:CXX>:/Zc:preprocessor>)
elseif(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
set(PROJECT_WARNINGS_CXX ${CLANG_WARNINGS})
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
Expand Down Expand Up @@ -55,9 +53,14 @@ add_library(vir-simd-test-fallback EXCLUDE_FROM_ALL vir/test.cpp)
target_link_libraries(vir-simd-test-fallback PRIVATE vir-simd)
target_compile_definitions(vir-simd-test-fallback PRIVATE VIR_DISABLE_STDX_SIMD)

add_custom_target(check DEPENDS vir-simd-test-stdlib vir-simd-test-fallback)
add_library(vir-simd-test-stdlib-cxx20 EXCLUDE_FROM_ALL vir/test.cpp)
target_link_libraries(vir-simd-test-stdlib-cxx20 PRIVATE vir-simd)
target_compile_features(vir-simd-test-stdlib-cxx20 PRIVATE cxx_std_20)

if(MSVC)
target_compile_options(vir-simd-test-stdlib PRIVATE /std:c++latest)
target_compile_options(vir-simd-test-fallback PRIVATE /std:c++latest)
endif()
add_library(vir-simd-test-fallback-cxx20 EXCLUDE_FROM_ALL vir/test.cpp)
target_link_libraries(vir-simd-test-fallback-cxx20 PRIVATE vir-simd)
target_compile_definitions(vir-simd-test-fallback-cxx20 PRIVATE VIR_DISABLE_STDX_SIMD)
target_compile_features(vir-simd-test-fallback-cxx20 PRIVATE cxx_std_20)

add_custom_target(check DEPENDS vir-simd-test-stdlib vir-simd-test-fallback
vir-simd-test-stdlib-cxx20 vir-simd-test-fallback-cxx20)

0 comments on commit 66858d6

Please sign in to comment.