diff --git a/cmake/modules/RootConfiguration.cmake b/cmake/modules/RootConfiguration.cmake index e34fadca7264ed2a669cba23f89104cac965e667..c7da615165eaddd6013a4911514e903e537c224b 100644 --- a/cmake/modules/RootConfiguration.cmake +++ b/cmake/modules/RootConfiguration.cmake @@ -494,19 +494,26 @@ else() set(hasveccore undef) endif() if(cxx11) - set(cxxversion cxx11) + set(cxxversion c++11) set(usec++11 define) else() set(usec++11 undef) endif() if(cxx14) - set(cxxversion cxx14) + set(cxxversion c++14) + # If we are using gcc 4.X and we want c++14, we need to use the --std=c++1y flag + # else, we continue with c++14. + if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0") + set(cxxversion c++1y) + endif() + endif() set(usec++14 define) else() set(usec++14 undef) endif() if(cxx17) - set(cxxversion cxx17) + set(cxxversion c++17) set(usec++17 define) else() set(usec++17 undef) @@ -560,12 +567,12 @@ if (tmva-cpu) set(hastmvacpu define) else() set(hastmvacpu undef) -endif() +endif() if (tmva-gpu) set(hastmvagpu define) else() set(hastmvagpu undef) -endif() +endif() CHECK_CXX_SOURCE_COMPILES("#include <string_view> @@ -815,7 +822,7 @@ install(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/thisroot.sh GROUP_READ WORLD_READ DESTINATION ${CMAKE_INSTALL_BINDIR}) - + install(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/memprobe ${CMAKE_BINARY_DIR}/installtree/root-config ${CMAKE_SOURCE_DIR}/cmake/scripts/setenvwrap.csh diff --git a/config/root-config.in b/config/root-config.in index 1c185f7a25675ca0553f7f08780911d7618ef39d..193551e6018956109c8fd056651edd82636ba143 100755 --- a/config/root-config.in +++ b/config/root-config.in @@ -145,11 +145,8 @@ fi ### machine dependent settings ### -case "$cxxversion" in - cxx17) cxxversionflag="-std=c++1z " ;; - cxx14) cxxversionflag="-std=c++1y " ;; - *) cxxversionflag="-std=c++11 " ;; -esac +# Set the C++ standard version +cxxversionflag="-std=${cxxversion} " case $arch in aix5)