]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: replace `unset(VAR)` with `set(VAR "")` for init
authorViktor Szakats <commit@vsz.me>
Wed, 6 Nov 2024 12:53:12 +0000 (13:53 +0100)
committerViktor Szakats <commit@vsz.me>
Mon, 16 Dec 2024 20:12:51 +0000 (21:12 +0100)
Also add cleanup `unset()`s where missing.

Reported-by: Kai Pastor
Bug: https://github.com/curl/curl/pull/15255#issuecomment-2458659626
Follow-up to 8b09138083640039ce35657a68eeb10b903ed0a5 #14610

Closes #15497

CMake/CurlSymbolHiding.cmake
CMake/FindLDAP.cmake
CMake/OtherTests.cmake
CMake/PickyWarnings.cmake
CMakeLists.txt
docs/libcurl/CMakeLists.txt
docs/libcurl/opts/CMakeLists.txt
tests/CMakeLists.txt

index 16ec3feccc716225ee43ab13a18bbe592ee649c8..df601aa3c2aa0a145f974507253a16c3787286b8 100644 (file)
@@ -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)
index 417eb57888db6e97403beeb8f59d881a7373c8dd..07346206ea61c066caa981ea03bd58389a716fc0 100644 (file)
@@ -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")
index 62eef12d711f42b6b17b1f3ef0edfcbc0c4313d2..5a9602368eeec8892652b32acb6b483e235532ea 100644 (file)
@@ -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")
index b62f97f10a73253921dd8e04cd1686df8e4a029b..eccab10deedfe40cebcf5a5da361d490e322ae8e 100644 (file)
@@ -23,7 +23,7 @@
 ###########################################################################
 include(CheckCCompilerFlag)
 
-unset(_picky)
+set(_picky "")
 
 if(CURL_WERROR AND
    ((CMAKE_COMPILER_IS_GNUCC AND
index f5d70c891cb3c0c194aa28baddfbf80f2b868cdb..412c8a4ab22bf674535fcb4f2aab54b0da1489b6 100644 (file)
@@ -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()
index 4af47af3420b9d0600c530530d097adbfca1d712..0241e58e00b70cfc9e05b5550a81a76c75097706 100644 (file)
@@ -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)
index 99683c406204e8f45bc906cb93dc180dc288ebe6..052d269043167729edf74495cb29c872b9d79ead 100644 (file)
@@ -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()
index 0e40b2e19243a36a4d562dc51cb3b8c6a4d3c801..86f229dde8330ff4ff0d91b8d165a6605e025dc2 100644 (file)
@@ -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()