@@ -27,34 +27,6 @@ else()
2727 message (STATUS "Tests build type is ${CMAKE_BUILD_TYPE} " )
2828endif ()
2929
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 ()
5830
5931if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Intel" AND NOT WIN32 ))
6032 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)
153125endif ()
154126
155127target_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 ()
156133
157134add_custom_target (xtest COMMAND test_xtensor_blas DEPENDS test_xtensor_blas)
158135add_test (NAME xtest COMMAND test_xtensor_blas)
0 commit comments