dolphin/CMakeTests/CheckAndAddFlag.cmake
Florent Castelli 08b73b8a77 cmake: Move check_and_add_flag to a separate file
Also make it add flags to both C and C++ when appropriate
2017-01-25 02:34:33 +01:00

15 lines
360 B
CMake

include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
macro(check_and_add_flag var flag)
check_c_compiler_flag(${flag} FLAG_C_${var})
if(FLAG_C_${var})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
endif()
check_cxx_compiler_flag(${flag} FLAG_CXX_${var})
if(FLAG_CXX_${var})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
endif()
endmacro()