Skip to content

Commit

Permalink
Add diagnostics printing C++ mode used
Browse files Browse the repository at this point in the history
- disable C++14 and up for Intel < V17
  • Loading branch information
hkaiser committed Jun 8, 2017
1 parent 9274768 commit d2884e5
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions cmake/HPX_DetectCppDialect.cmake
Expand Up @@ -9,21 +9,30 @@ macro(hpx_detect_cpp_dialect)
if(NOT MSVC)
if(HPX_WITH_CUDA AND NOT HPX_WITH_CUDA_CLANG)
set(CXX_FLAG -std=c++11)
hpx_info("C++ mode used: C++11")
else()

# Try -std=c++17 first
check_cxx_compiler_flag(-std=c++17 HPX_WITH_CXX17)
if(HPX_WITH_CXX17 OR NOT (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17)))
check_cxx_compiler_flag(-std=c++17 HPX_WITH_CXX17)
endif()

if(HPX_WITH_CXX17)
set(CXX_FLAG -std=c++17)
add_definitions(-DBOOST_NO_AUTO_PTR)
hpx_info("C++ mode used: C++17")
else()
# ... otherwise try -std=c++1z
check_cxx_compiler_flag(-std=c++1z HPX_WITH_CXX1Z)
if(HPX_WITH_CXX1Z OR NOT (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17)))
check_cxx_compiler_flag(-std=c++1z HPX_WITH_CXX1Z)
endif()

if(HPX_WITH_CXX1Z)
set(CXX_FLAG -std=c++1z)
add_definitions(-DBOOST_NO_AUTO_PTR)
hpx_info("C++ mode used: C++1z")
else()
# ... otherwise try -std=c++14
if(HPX_WITH_CXX14 OR NOT (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
Expand All @@ -41,6 +50,7 @@ macro(hpx_detect_cpp_dialect)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
add_definitions(-DBOOST_NO_CXX14_CONSTEXPR)
endif()
hpx_info("C++ mode used: C++14")
else()
# ... otherwise try -std=c++1y
if(HPX_WITH_CXX1Y OR NOT (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
Expand All @@ -50,16 +60,19 @@ macro(hpx_detect_cpp_dialect)

if(HPX_WITH_CXX1Y)
set(CXX_FLAG -std=c++1y)
hpx_info("C++ mode used: C++1y")
else()
# ... otherwise try -std=c++11
check_cxx_compiler_flag(-std=c++11 HPX_WITH_CXX11)
if(HPX_WITH_CXX11)
set(CXX_FLAG -std=c++11)
hpx_info("C++ mode used: C++11")
else()
# ... otherwise try -std=c++0x
check_cxx_compiler_flag(-std=c++0x HPX_WITH_CXX0X)
if(HPX_WITH_CXX0X)
set(CXX_FLAG -std=c++0x)
hpx_info("C++ mode used: C++0x")
endif()
endif()
endif()
Expand Down

0 comments on commit d2884e5

Please sign in to comment.