mirror of
https://github.com/curl/curl.git
synced 2026-08-25 06:23:30 +03:00
cmake: use cmake_push_check_state() around feature checks
Enclose `CMAKE_EXTRA_INCLUDE_FILES`, `CMAKE_REQUIRED_DEFINITIONS`, `CMAKE_REQUIRED_FLAGS`, `CMAKE_REQUIRED_INCLUDES`, `CMAKE_REQUIRED_LIBRARIES`, `CMAKE_REQUIRED_LINK_OPTIONS`, settings within `cmake_push_check_state()`/`cmake_pop_check_state()` calls. It prevents spilling them into other feature checks. It also replaces manual resets found in some places (which can have the undesired side-effect of destroying values meant for global use.) Cherry-picked from #15157 Closes #15251
This commit is contained in:
parent
ae5e538e57
commit
91519bfb74
4 changed files with 21 additions and 19 deletions
|
|
@ -176,6 +176,7 @@ if(NOT _GSS_FOUND) # Not found by pkg-config. Let us take more traditional appr
|
|||
)
|
||||
|
||||
if(_GSS_INCLUDE_DIRS) # jay, we have found something
|
||||
cmake_push_check_state()
|
||||
set(CMAKE_REQUIRED_INCLUDES "${_GSS_INCLUDE_DIRS}")
|
||||
check_include_files("gssapi/gssapi_generic.h;gssapi/gssapi_krb5.h" _gss_have_mit_headers)
|
||||
|
||||
|
|
@ -190,8 +191,8 @@ if(NOT _GSS_FOUND) # Not found by pkg-config. Let us take more traditional appr
|
|||
if(_gss_have_roken_h OR _gss_have_heimdal_roken_h)
|
||||
set(GSS_FLAVOUR "Heimdal")
|
||||
endif()
|
||||
list(REMOVE_ITEM CMAKE_REQUIRED_DEFINITIONS "-D__ROKEN_H__")
|
||||
endif()
|
||||
cmake_pop_check_state()
|
||||
else()
|
||||
# I am not convinced if this is the right way but this is what autotools do at the moment
|
||||
find_path(_GSS_INCLUDE_DIRS NAMES "gssapi.h"
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ endmacro()
|
|||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
|
||||
if(NOT DEFINED HAVE_STRUCT_SOCKADDR_STORAGE)
|
||||
cmake_push_check_state()
|
||||
unset(CMAKE_EXTRA_INCLUDE_FILES)
|
||||
if(WIN32)
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES "winsock2.h")
|
||||
|
|
@ -45,7 +46,7 @@ if(NOT DEFINED HAVE_STRUCT_SOCKADDR_STORAGE)
|
|||
endif()
|
||||
check_type_size("struct sockaddr_storage" SIZEOF_STRUCT_SOCKADDR_STORAGE)
|
||||
set(HAVE_STRUCT_SOCKADDR_STORAGE ${HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE})
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES "")
|
||||
cmake_pop_check_state()
|
||||
endif()
|
||||
|
||||
if(NOT WIN32)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue