Skip to content

Commit 1bd5ba2

Browse files
authored
Merge pull request #153 from BioDataAnalysis/bda_improve_cmake_3_17_support
Added support for cmake 3.17 to test/set_compiler_flag.cmake
2 parents 7799c43 + e39affa commit 1bd5ba2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/set_compiler_flag.cmake

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ function(set_compiler_flag _result _lang)
3838
set(_flag_found FALSE)
3939
# loop over all flags, try to find the first which works
4040
foreach(flag IN ITEMS ${_list_of_flags})
41-
41+
# Note: since cmake-3.17-rc1 its not sufficient to unset _flag_works
42+
# from the cache, so this double-unset is relevant:
43+
unset(_flag_works)
4244
unset(_flag_works CACHE)
4345
if(_lang STREQUAL "C")
4446
check_c_compiler_flag("${flag}" _flag_works)
@@ -53,9 +55,16 @@ function(set_compiler_flag _result _lang)
5355
# if the flag works, use it, and exit
5456
# otherwise try next flag
5557
if(_flag_works)
58+
if(NOT CMAKE_REQUIRED_QUIET)
59+
message(STATUS "Found flag ${flag} for language ${_lang} is supported")
60+
endif()
5661
set(${_result} "${flag}" PARENT_SCOPE)
5762
set(_flag_found TRUE)
5863
break()
64+
else()
65+
if(NOT CMAKE_REQUIRED_QUIET)
66+
message(STATUS "Found flag ${flag} for language ${_lang} is not supported")
67+
endif()
5968
endif()
6069
endforeach()
6170

0 commit comments

Comments
 (0)