Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion test/set_compiler_flag.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ function(set_compiler_flag _result _lang)
set(_flag_found FALSE)
# loop over all flags, try to find the first which works
foreach(flag IN ITEMS ${_list_of_flags})

# Note: since cmake-3.17-rc1 its not sufficient to unset _flag_works
# from the cache, so this double-unset is relevant:
unset(_flag_works)
unset(_flag_works CACHE)
if(_lang STREQUAL "C")
check_c_compiler_flag("${flag}" _flag_works)
Expand All @@ -53,9 +55,16 @@ function(set_compiler_flag _result _lang)
# if the flag works, use it, and exit
# otherwise try next flag
if(_flag_works)
if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Found flag ${flag} for language ${_lang} is supported")
endif()
set(${_result} "${flag}" PARENT_SCOPE)
set(_flag_found TRUE)
break()
else()
if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Found flag ${flag} for language ${_lang} is not supported")
endif()
endif()
endforeach()

Expand Down