Skip to content

Commit

Permalink
Merge pull request #3303 from OSGeo/backport-3302-to-9.1
Browse files Browse the repository at this point in the history
[Backport 9.1] CMake: fix symbol detection when CFLAGS includes -Werror=something (fixes #3295)
  • Loading branch information
kbevers authored Aug 27, 2022
2 parents 2866b3d + ea151cd commit 7d3c242
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmake/ProjConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ include(CheckFunctionExists)
# if C flags have -Werror, temporarily remove these while running some checks
string(FIND "${CMAKE_C_FLAGS}" "-Werror" FIND_WERROR)
if(FIND_WERROR GREATER_EQUAL 0)
string(REPLACE "-Werror" "" _tmp_CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
# we must be careful about not matching -Werror=something, so let's append
# a space at the end of CMAKE_C_FLAGS and match -Werror with a trailing space
string(REPLACE "-Werror " " " _tmp_CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ")
set(_prev_CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS "${_tmp_CMAKE_C_FLAGS}")
endif()
Expand Down

0 comments on commit 7d3c242

Please sign in to comment.