Only apply c++14 to current target

This commit is contained in:
Sebastian Messmer 2018-10-21 20:58:19 +02:00
parent 42f0b00828
commit ac0b9a6e45

View File

@ -12,11 +12,11 @@ function(target_activate_cpp14 TARGET)
else("${CMAKE_VERSION}" VERSION_GREATER "3.1") else("${CMAKE_VERSION}" VERSION_GREATER "3.1")
check_cxx_compiler_flag("-std=c++14" COMPILER_HAS_CPP14_SUPPORT) check_cxx_compiler_flag("-std=c++14" COMPILER_HAS_CPP14_SUPPORT)
if (COMPILER_HAS_CPP14_SUPPORT) if (COMPILER_HAS_CPP14_SUPPORT)
target_compile_options(${TARGET} PUBLIC -std=c++14) target_compile_options(${TARGET} PRIVATE -std=c++14)
else(COMPILER_HAS_CPP14_SUPPORT) else(COMPILER_HAS_CPP14_SUPPORT)
check_cxx_compiler_flag("-std=c++1y" COMPILER_HAS_CPP14_PARTIAL_SUPPORT) check_cxx_compiler_flag("-std=c++1y" COMPILER_HAS_CPP14_PARTIAL_SUPPORT)
if (COMPILER_HAS_CPP14_PARTIAL_SUPPORT) if (COMPILER_HAS_CPP14_PARTIAL_SUPPORT)
target_compile_options(${TARGET} PUBLIC -std=c++1y) target_compile_options(${TARGET} PRIVATE -std=c++1y)
else() else()
message(FATAL_ERROR "Compiler doesn't support C++14") message(FATAL_ERROR "Compiler doesn't support C++14")
endif() endif()