@@ -25,34 +25,6 @@ else()
2525 message (STATUS "Tests build type is ${CMAKE_BUILD_TYPE} " )
2626endif ()
2727
28- include (CheckCXXCompilerFlag)
29-
30- string (TOUPPER "${CMAKE_BUILD_TYPE} " U_CMAKE_BUILD_TYPE)
31-
32- include (set_compiler_flag.cmake)
33-
34- if (CPP17)
35- # User requested C++17, but compiler might not oblige.
36- set_compiler_flag(
37- _cxx_std_flag CXX
38- "-std=c++17" # this should work with GNU, Intel, PGI
39- "/std:c++17" # this should work with MSVC
40- )
41- if (_cxx_std_flag)
42- message (STATUS "Building with C++17" )
43- endif ()
44- else ()
45- set_compiler_flag(
46- _cxx_std_flag CXX REQUIRED
47- "-std=c++14" # this should work with GNU, Intel, PGI
48- "/std:c++14" # this should work with MSVC
49- )
50- message (STATUS "Building with C++14" )
51- endif ()
52-
53- if (NOT _cxx_std_flag)
54- message (FATAL_ERROR "xtensor-blas needs a C++14-compliant compiler." )
55- endif ()
5628
5729if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Intel" AND NOT WIN32 ))
5830 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_cxx_std_flag} -march=native -Wunused-parameter -Wextra -Wreorder -Wconversion -Wsign-conversion" )
@@ -146,5 +118,10 @@ if(DOWNLOAD_GTEST OR GTEST_SRC_DIR)
146118endif ()
147119
148120target_link_libraries (test_xtensor_blas ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} )
121+ if (CPP17)
122+ target_compile_features (test_xtensor_blas PUBLIC cxx_std_17)
123+ else ()
124+ target_compile_features (test_xtensor_blas PUBLIC cxx_std_14)
125+ endif ()
149126
150127add_custom_target (xtest COMMAND test_xtensor_blas DEPENDS test_xtensor_blas)
0 commit comments