@@ -27,34 +27,6 @@ else()
27
27
message (STATUS "Tests build type is ${CMAKE_BUILD_TYPE} " )
28
28
endif ()
29
29
30
- include (CheckCXXCompilerFlag)
31
-
32
- string (TOUPPER "${CMAKE_BUILD_TYPE} " U_CMAKE_BUILD_TYPE)
33
-
34
- include (set_compiler_flag.cmake)
35
-
36
- if (CPP17)
37
- # User requested C++17, but compiler might not oblige.
38
- set_compiler_flag(
39
- _cxx_std_flag CXX
40
- "-std=c++17" # this should work with GNU, Intel, PGI
41
- "/std:c++17" # this should work with MSVC
42
- )
43
- if (_cxx_std_flag)
44
- message (STATUS "Building with C++17" )
45
- endif ()
46
- else ()
47
- set_compiler_flag(
48
- _cxx_std_flag CXX REQUIRED
49
- "-std=c++14" # this should work with GNU, Intel, PGI
50
- "/std:c++14" # this should work with MSVC
51
- )
52
- message (STATUS "Building with C++14" )
53
- endif ()
54
-
55
- if (NOT _cxx_std_flag)
56
- message (FATAL_ERROR "xtensor-blas needs a C++14-compliant compiler." )
57
- endif ()
58
30
59
31
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Intel" AND NOT WIN32 ))
60
32
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_cxx_std_flag} -march=native -Wunused-parameter -Wextra -Wreorder -Wconversion -Wsign-conversion" )
@@ -153,6 +125,11 @@ if(DOWNLOAD_GTEST OR GTEST_SRC_DIR)
153
125
endif ()
154
126
155
127
target_link_libraries (test_xtensor_blas ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} GTest::GTest GTest::Main ${CMAKE_THREAD_LIBS_INIT} )
128
+ if (CPP17)
129
+ target_compile_features (test_xtensor_blas PUBLIC cxx_std_17)
130
+ else ()
131
+ target_compile_features (test_xtensor_blas PUBLIC cxx_std_14)
132
+ endif ()
156
133
157
134
add_custom_target (xtest COMMAND test_xtensor_blas DEPENDS test_xtensor_blas)
158
135
add_test (NAME xtest COMMAND test_xtensor_blas)
0 commit comments