link_flag: reset the link flags after the link test

This commit is contained in:
Danny Robson 2017-01-23 16:47:03 +11:00
parent 7917ab4ae8
commit acac995e0b

View File

@ -4,7 +4,7 @@ macro(check_link_flag _variable _flag)
if (NOT DEFINED __check_link_flag_${_name})
message (STATUS "checking linker flag ${_flag}")
set (__check_linker_flag_old "${CMAKE_EXE_LINKER_FLAGS}" INTERNAL)
set (__check_linker_flag_old "${CMAKE_EXE_LINKER_FLAGS}")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${_flag}")
try_compile (
@ -18,6 +18,8 @@ macro(check_link_flag _variable _flag)
else()
message (STATUS "checking linker flag ${_flag} - not found")
endif()
set (CMAKE_EXE_LINKER_FLAGS "${__check_linker_flag_old}")
endif ()
if (__check_link_flag_${_name})