aboutsummaryrefslogtreecommitdiff
path: root/cmake/ProjConfig.cmake
diff options
context:
space:
mode:
authorMike Taves <mwtoews@gmail.com>2022-01-24 00:45:14 +1300
committerGitHub <noreply@github.com>2022-01-24 00:45:14 +1300
commit93a533906e855a19ab5e64849df91e6fe9940712 (patch)
tree93216e4c071bfaf79beaf9c4e0874d79f39a2db6 /cmake/ProjConfig.cmake
parent93c3a165126ac4c7caf4d2ffa2f7dd71633e7be3 (diff)
downloadPROJ-93a533906e855a19ab5e64849df91e6fe9940712.tar.gz
PROJ-93a533906e855a19ab5e64849df91e6fe9940712.zip
CI: transition tests from autotools to cmake (#3023)
Diffstat (limited to 'cmake/ProjConfig.cmake')
-rw-r--r--cmake/ProjConfig.cmake17
1 files changed, 15 insertions, 2 deletions
diff --git a/cmake/ProjConfig.cmake b/cmake/ProjConfig.cmake
index a53c3af1..fa9fd6a4 100644
--- a/cmake/ProjConfig.cmake
+++ b/cmake/ProjConfig.cmake
@@ -10,12 +10,25 @@
include(CheckLibraryExists)
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})
+ set(_prev_CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
+ set(CMAKE_C_FLAGS "${_tmp_CMAKE_C_FLAGS}")
+endif()
+
# check needed include file
check_function_exists(localeconv HAVE_LOCALECONV)
check_function_exists(strerror HAVE_STRERROR)
if(NOT WIN32)
- check_library_exists(dl dladdr "" HAVE_LIBDL)
- check_library_exists(m exp "" HAVE_LIBM)
+ check_library_exists(dl dladdr "" HAVE_LIBDL)
+ check_library_exists(m exp "" HAVE_LIBM)
+endif()
+
+# restore CMAKE_C_FLAGS as before
+if(FIND_WERROR GREATER_EQUAL 0)
+ set(CMAKE_C_FLAGS "${_prev_CMAKE_C_FLAGS}")
endif()
set(PACKAGE "proj")