cmake/compile_flag.cmake

14 lines
367 B
CMake

include(CheckCXXCompilerFlag)
macro (append_compile_flag _flag)
string (MAKE_C_IDENTIFIER ${_flag} _name)
if (NOT DEFINED compile_flag_${_name})
check_cxx_compiler_flag (${_flag} compile_flag_${_name})
endif ()
if (compile_flag_${_name})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flag}")
endif()
endmacro(append_compile_flag)