mirror of
https://github.com/curl/curl.git
synced 2026-08-02 22:20:27 +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
|
|
@ -249,7 +249,9 @@ if(BUILD_SHARED_LIBS)
|
|||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/libcurl.vers.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/libcurl.vers" @ONLY)
|
||||
include(CMakePushCheckState)
|
||||
include(CheckCSourceCompiles)
|
||||
cmake_push_check_state()
|
||||
set(CMAKE_REQUIRED_LINK_OPTIONS "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/libcurl.vers")
|
||||
check_c_source_compiles("int main(void) { return 0; }" HAVE_VERSIONED_SYMBOLS)
|
||||
if(HAVE_VERSIONED_SYMBOLS)
|
||||
|
|
@ -258,7 +260,7 @@ if(BUILD_SHARED_LIBS)
|
|||
else()
|
||||
message(WARNING "Versioned symbols requested, but not supported by the toolchain.")
|
||||
endif()
|
||||
unset(CMAKE_REQUIRED_LINK_OPTIONS)
|
||||
cmake_pop_check_state()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue