mirror of
https://github.com/curl/curl.git
synced 2026-08-25 17:23:37 +03:00
cmake: replace unset(VAR) with set(VAR "") for init
Also add cleanup `unset()`s where missing.
Reported-by: Kai Pastor
Bug: https://github.com/curl/curl/pull/15255#issuecomment-2458659626
Follow-up to 8b09138083 #14610
Closes #15497
This commit is contained in:
parent
ca348a64f4
commit
b4aa93114c
8 changed files with 22 additions and 19 deletions
|
|
@ -32,8 +32,8 @@ if(WIN32 AND (ENABLE_DEBUG OR ENABLE_CURLDEBUG))
|
|||
endif()
|
||||
|
||||
set(CURL_HIDES_PRIVATE_SYMBOLS FALSE)
|
||||
unset(CURL_EXTERN_SYMBOL)
|
||||
unset(CURL_CFLAG_SYMBOLS_HIDE)
|
||||
set(CURL_EXTERN_SYMBOL "")
|
||||
set(CURL_CFLAG_SYMBOLS_HIDE "")
|
||||
|
||||
if(CURL_HIDDEN_SYMBOLS)
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT MSVC)
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ else()
|
|||
# ldap.h and lber.h both being stubs to include <ldap.h> and <lber.h>.
|
||||
# This causes an infinite inclusion loop in compile.
|
||||
set(_save_cmake_system_framework_path ${CMAKE_SYSTEM_FRAMEWORK_PATH})
|
||||
unset(CMAKE_SYSTEM_FRAMEWORK_PATH)
|
||||
set(CMAKE_SYSTEM_FRAMEWORK_PATH "")
|
||||
find_path(LDAP_INCLUDE_DIR NAMES "ldap.h")
|
||||
set(CMAKE_SYSTEM_FRAMEWORK_PATH ${_save_cmake_system_framework_path})
|
||||
find_library(LDAP_LIBRARY NAMES "ldap")
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
|
|||
|
||||
if(NOT DEFINED HAVE_STRUCT_SOCKADDR_STORAGE)
|
||||
cmake_push_check_state()
|
||||
unset(CMAKE_EXTRA_INCLUDE_FILES)
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES "")
|
||||
if(WIN32)
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES "winsock2.h")
|
||||
set(CMAKE_REQUIRED_LIBRARIES "ws2_32")
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
###########################################################################
|
||||
include(CheckCCompilerFlag)
|
||||
|
||||
unset(_picky)
|
||||
set(_picky "")
|
||||
|
||||
if(CURL_WERROR AND
|
||||
((CMAKE_COMPILER_IS_GNUCC AND
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ project(CURL
|
|||
VERSION "${_curl_version_sem}"
|
||||
LANGUAGES C)
|
||||
|
||||
unset(_target_flags)
|
||||
set(_target_flags "")
|
||||
if(APPLE)
|
||||
set(_target_flags "${_target_flags} APPLE")
|
||||
endif()
|
||||
|
|
@ -1874,7 +1874,7 @@ if(NOT CURL_DISABLE_NTLM AND
|
|||
endif()
|
||||
|
||||
# Clear list and try to detect available protocols
|
||||
unset(_items)
|
||||
set(_items "")
|
||||
_add_if("HTTP" NOT CURL_DISABLE_HTTP)
|
||||
_add_if("HTTPS" NOT CURL_DISABLE_HTTP AND _ssl_enabled)
|
||||
_add_if("FTP" NOT CURL_DISABLE_FTP)
|
||||
|
|
@ -1917,7 +1917,7 @@ string(TOLOWER "${SUPPORT_PROTOCOLS}" _support_protocols_lower)
|
|||
message(STATUS "Protocols: ${_support_protocols_lower}")
|
||||
|
||||
# Clear list and try to detect available features
|
||||
unset(_items)
|
||||
set(_items "")
|
||||
_add_if("SSL" _ssl_enabled)
|
||||
_add_if("IPv6" ENABLE_IPV6)
|
||||
_add_if("UnixSockets" USE_UNIX_SOCKETS)
|
||||
|
|
@ -1969,7 +1969,7 @@ string(REPLACE ";" " " SUPPORT_FEATURES "${_items}")
|
|||
message(STATUS "Features: ${SUPPORT_FEATURES}")
|
||||
|
||||
# Clear list and collect SSL backends
|
||||
unset(_items)
|
||||
set(_items "")
|
||||
_add_if("Schannel" _ssl_enabled AND USE_SCHANNEL)
|
||||
_add_if("OpenSSL" _ssl_enabled AND USE_OPENSSL AND OPENSSL_VERSION VERSION_LESS 3.0.0)
|
||||
_add_if("OpenSSL v3+" _ssl_enabled AND USE_OPENSSL AND NOT OPENSSL_VERSION VERSION_LESS 3.0.0)
|
||||
|
|
@ -2041,7 +2041,7 @@ if(NOT CURL_DISABLE_INSTALL)
|
|||
endforeach()
|
||||
|
||||
# Avoid getting unnecessary -L options for known system directories.
|
||||
unset(_sys_libdirs)
|
||||
set(_sys_libdirs "")
|
||||
foreach(_libdir IN LISTS CMAKE_SYSTEM_PREFIX_PATH)
|
||||
if(_libdir MATCHES "/$")
|
||||
set(_libdir "${_libdir}lib")
|
||||
|
|
@ -2066,7 +2066,7 @@ if(NOT CURL_DISABLE_INSTALL)
|
|||
endif()
|
||||
endforeach()
|
||||
|
||||
unset(_implicit_libs)
|
||||
set(_implicit_libs "")
|
||||
if(NOT MINGW AND NOT UNIX)
|
||||
set(_implicit_libs ${CMAKE_C_IMPLICIT_LINK_LIBRARIES})
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ function(add_manual_pages _listname)
|
|||
set(_files_per_batch 200)
|
||||
endif()
|
||||
set(_file_count 0)
|
||||
unset(_rofffiles)
|
||||
unset(_mdfiles)
|
||||
set(_rofffiles "")
|
||||
set(_mdfiles "")
|
||||
set(_eol "_EOL_")
|
||||
foreach(_file IN LISTS ${_listname} _eol)
|
||||
math(EXPR _file_count "${_file_count} + 1")
|
||||
|
|
@ -46,8 +46,8 @@ function(add_manual_pages _listname)
|
|||
VERBATIM
|
||||
)
|
||||
set(_file_count 0)
|
||||
unset(_rofffiles)
|
||||
unset(_mdfiles)
|
||||
set(_rofffiles "")
|
||||
set(_mdfiles "")
|
||||
endif()
|
||||
|
||||
list(APPEND _rofffiles "${CMAKE_CURRENT_BINARY_DIR}/${_file}")
|
||||
|
|
@ -59,6 +59,8 @@ function(add_manual_pages _listname)
|
|||
endif()
|
||||
list(APPEND _mdfiles "${_mdfile}")
|
||||
endforeach()
|
||||
unset(_rofffiles)
|
||||
unset(_mdfiles)
|
||||
endfunction()
|
||||
|
||||
add_custom_command(OUTPUT "libcurl-symbols.md"
|
||||
|
|
@ -75,11 +77,12 @@ add_custom_command(OUTPUT "libcurl-symbols.md"
|
|||
add_manual_pages(man_MANS)
|
||||
add_custom_target(curl-man ALL DEPENDS ${man_MANS})
|
||||
if(NOT CURL_DISABLE_INSTALL)
|
||||
unset(_src)
|
||||
set(_src "")
|
||||
foreach(_f IN LISTS man_MANS)
|
||||
list(APPEND _src "${CMAKE_CURRENT_BINARY_DIR}/${_f}")
|
||||
endforeach()
|
||||
install(FILES ${_src} DESTINATION "${CMAKE_INSTALL_MANDIR}/man3")
|
||||
unset(_src)
|
||||
endif()
|
||||
|
||||
add_subdirectory(opts)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ add_manual_pages(man_MANS)
|
|||
add_custom_target(curl-opts-man DEPENDS ${man_MANS})
|
||||
add_dependencies(curl-man curl-opts-man)
|
||||
if(NOT CURL_DISABLE_INSTALL)
|
||||
unset(_src)
|
||||
set(_src "")
|
||||
foreach(_f IN LISTS man_MANS)
|
||||
list(APPEND _src "${CMAKE_CURRENT_BINARY_DIR}/${_f}")
|
||||
endforeach()
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ function(add_runtests _targetname _test_flags)
|
|||
# Skip walking through dependent targets before running tests in CI.
|
||||
# This avoids: GNU Make doing a slow re-evaluation of all targets and
|
||||
# skipping them, MSBuild doing a re-evaluation, and actually rebuilding them.
|
||||
unset(_depends)
|
||||
set(_depends "")
|
||||
if(NOT _targetname STREQUAL "test-ci")
|
||||
set(_depends "testdeps")
|
||||
endif()
|
||||
|
|
@ -69,7 +69,7 @@ function(add_runtests _targetname _test_flags)
|
|||
endfunction()
|
||||
|
||||
function(add_pytest _targetname _test_flags)
|
||||
unset(_depends)
|
||||
set(_depends "")
|
||||
if(NOT _targetname STREQUAL "pytest-ci")
|
||||
set(_depends "test-http-clients")
|
||||
endif()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue