CMAKE_CXX_FLAGS is space-separated, not semicolon-separated

This commit is contained in:
heinrich5991 2018-01-22 19:48:17 +01:00
parent ccad91a11d
commit 9712a4494b

View file

@ -109,26 +109,16 @@ function(add_c_compiler_flag_if_supported VARIABLE FLAG)
endif()
endfunction()
function(add_cxx_compiler_flag_if_supported VARIABLE FLAG)
if(ARGC GREATER 2)
set(CHECKED_FLAG "${ARGV2}")
else()
set(CHECKED_FLAG "${FLAG}")
endif()
string(REGEX REPLACE "[^A-Za-z0-9]" "_" CONFIG_VARIABLE "FLAG_SUPPORTED${CHECKED_FLAG}")
check_cxx_compiler_flag("${CHECKED_FLAG}" ${CONFIG_VARIABLE})
if(${CONFIG_VARIABLE})
if(${VARIABLE})
set("${VARIABLE}" "${${VARIABLE}};${FLAG}" PARENT_SCOPE)
else()
set("${VARIABLE}" "${FLAG}" PARENT_SCOPE)
endif()
endif()
endfunction()
if(NOT MSVC)
if(CMAKE_VERSION VERSION_LESS 3.1 OR TARGET_OS STREQUAL "mac")
add_cxx_compiler_flag_if_supported(CMAKE_CXX_FLAGS -std=gnu++11)
check_cxx_compiler_flag(-std=gnu++11 FLAG_SUPPORTED_std_gnu__11)
if(FLAG_SUPPORTED_std_gnu__11)
if(CMAKE_CXX_FLAGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
else()
set(CMAKE_CXX_FLAGS -std=gnu++11)
endif()
endif()
endif()
# Protect the stack pointer.