From 93a533906e855a19ab5e64849df91e6fe9940712 Mon Sep 17 00:00:00 2001 From: Mike Taves Date: Mon, 24 Jan 2022 00:45:14 +1300 Subject: CI: transition tests from autotools to cmake (#3023) --- cmake/ProjConfig.cmake | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'cmake') 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") -- cgit v1.2.3