summaryrefslogtreecommitdiffstats
path: root/Utilities/cmcurl/lib/CMakeLists.txt
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-10-12 19:29:04 (GMT)
committerBrad King <brad.king@kitware.com>2023-10-12 19:29:20 (GMT)
commitdf4efb72e4225dc3fd4f32313bc8b19122a98f66 (patch)
treedbbb93a136f4f44184cbab061b03489379ef717c /Utilities/cmcurl/lib/CMakeLists.txt
parent8f6a6b02e59c112dbe971adca4f25938903828ea (diff)
parente6a6c1abc1e6b6e3ca9fa77947279509b55e2b01 (diff)
downloadCMake-df4efb72e4225dc3fd4f32313bc8b19122a98f66.zip
CMake-df4efb72e4225dc3fd4f32313bc8b19122a98f66.tar.gz
CMake-df4efb72e4225dc3fd4f32313bc8b19122a98f66.tar.bz2
Merge branch 'upstream-curl' into update-curl
* upstream-curl: curl 2023-10-11 (d755a5f7) Issue: #25329
Diffstat (limited to 'Utilities/cmcurl/lib/CMakeLists.txt')
-rw-r--r--Utilities/cmcurl/lib/CMakeLists.txt51
1 files changed, 21 insertions, 30 deletions
diff --git a/Utilities/cmcurl/lib/CMakeLists.txt b/Utilities/cmcurl/lib/CMakeLists.txt
index c4c6956..9899b9d 100644
--- a/Utilities/cmcurl/lib/CMakeLists.txt
+++ b/Utilities/cmcurl/lib/CMakeLists.txt
@@ -94,9 +94,9 @@ add_library(
target_compile_definitions(curlu PUBLIC UNITTESTS CURL_STATICLIB)
if(ENABLE_CURLDEBUG)
- # We must compile memdebug.c separately to avoid memdebug.h redefinitions
- # being applied to memdebug.c itself.
- set_source_files_properties(memdebug.c PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
+ # We must compile these sources separately to avoid memdebug.h redefinitions
+ # applying to them.
+ set_source_files_properties(memdebug.c curl_multibyte.c PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
endif()
target_link_libraries(curlu PRIVATE ${CURL_LIBS})
@@ -123,19 +123,6 @@ else()
unset(CMAKESONAME)
endif()
-if(NOT WIN32 AND NOT CMAKE_CROSSCOMPILING)
- # on not-Windows and not-crosscompiling, check for writable argv[]
- include(CheckCSourceRuns)
- check_c_source_runs("
-int main(int argc, char **argv)
-{
- (void)argc;
- argv[0][0] = ' ';
- return (argv[0][0] == ' ')?0:1;
-}"
- HAVE_WRITABLE_ARGV)
-endif()
-
## Library definition
# Add "_imp" as a suffix before the extension to avoid conflicting with
@@ -160,18 +147,23 @@ if(NOT DEFINED SHARE_LIB_OBJECT)
endif()
endif()
+if(WIN32)
+ # Define CURL_STATICLIB always, to disable __declspec(dllexport) for exported
+ # libcurl symbols. We handle exports via libcurl.def instead. Except with
+ # symbol hiding disabled or debug mode enabled, when we export _all_ symbols
+ # from libcurl DLL, without using libcurl.def.
+ add_definitions("-DCURL_STATICLIB")
+endif()
+
if(SHARE_LIB_OBJECT)
set(LIB_OBJECT "libcurl_object")
add_library(${LIB_OBJECT} OBJECT ${HHEADERS} ${CSOURCES})
target_link_libraries(${LIB_OBJECT} PRIVATE ${CURL_LIBS})
set_target_properties(${LIB_OBJECT} PROPERTIES
- COMPILE_DEFINITIONS "BUILDING_LIBCURL"
- INTERFACE_COMPILE_DEFINITIONS "CURL_STATICLIB"
POSITION_INDEPENDENT_CODE ON)
if(HIDES_CURL_PRIVATE_SYMBOLS)
- set_target_properties(${LIB_OBJECT} PROPERTIES
- COMPILE_DEFINITIONS "CURL_HIDDEN_SYMBOLS"
- COMPILE_FLAGS "${CURL_CFLAG_SYMBOLS_HIDE}")
+ set_property(TARGET ${LIB_OBJECT} APPEND PROPERTY COMPILE_FLAGS "${CURL_CFLAG_SYMBOLS_HIDE}")
+ set_property(TARGET ${LIB_OBJECT} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_HIDDEN_SYMBOLS")
endif()
if(CURL_HAS_LTO)
set_target_properties(${LIB_OBJECT} PROPERTIES
@@ -198,12 +190,10 @@ if(BUILD_STATIC_LIBS)
set_target_properties(${LIB_STATIC} PROPERTIES
PREFIX "" OUTPUT_NAME "${LIBCURL_OUTPUT_NAME}"
SUFFIX "${STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}"
- COMPILE_DEFINITIONS "BUILDING_LIBCURL"
INTERFACE_COMPILE_DEFINITIONS "CURL_STATICLIB")
if(HIDES_CURL_PRIVATE_SYMBOLS)
- set_target_properties(${LIB_STATIC} PROPERTIES
- COMPILE_DEFINITIONS "CURL_HIDDEN_SYMBOLS"
- COMPILE_FLAGS "${CURL_CFLAG_SYMBOLS_HIDE}")
+ set_property(TARGET ${LIB_STATIC} APPEND PROPERTY COMPILE_FLAGS "${CURL_CFLAG_SYMBOLS_HIDE}")
+ set_property(TARGET ${LIB_STATIC} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_HIDDEN_SYMBOLS")
endif()
if(CURL_HAS_LTO)
set_target_properties(${LIB_STATIC} PROPERTIES
@@ -225,19 +215,20 @@ if(BUILD_SHARED_LIBS)
add_library(${LIB_SHARED} SHARED ${LIB_SOURCE})
add_library(${PROJECT_NAME}::${LIB_SHARED} ALIAS ${LIB_SHARED})
if(WIN32)
- set_property(TARGET ${LIB_SHARED} APPEND PROPERTY SOURCES libcurl.rc ${CURL_SOURCE_DIR}/libcurl.def)
+ set_property(TARGET ${LIB_SHARED} APPEND PROPERTY SOURCES libcurl.rc)
+ if(HIDES_CURL_PRIVATE_SYMBOLS)
+ set_property(TARGET ${LIB_SHARED} APPEND PROPERTY SOURCES "${CURL_SOURCE_DIR}/libcurl.def")
+ endif()
endif()
target_link_libraries(${LIB_SHARED} PRIVATE ${CURL_LIBS})
# Remove the "lib" prefix since the library is already named "libcurl".
set_target_properties(${LIB_SHARED} PROPERTIES
PREFIX "" OUTPUT_NAME "${LIBCURL_OUTPUT_NAME}"
IMPORT_PREFIX "" IMPORT_SUFFIX "${IMPORT_LIB_SUFFIX}${CMAKE_IMPORT_LIBRARY_SUFFIX}"
- COMPILE_DEFINITIONS "BUILDING_LIBCURL"
POSITION_INDEPENDENT_CODE ON)
if(HIDES_CURL_PRIVATE_SYMBOLS)
- set_target_properties(${LIB_SHARED} PROPERTIES
- COMPILE_DEFINITIONS "CURL_HIDDEN_SYMBOLS"
- COMPILE_FLAGS "${CURL_CFLAG_SYMBOLS_HIDE}")
+ set_property(TARGET ${LIB_SHARED} APPEND PROPERTY COMPILE_FLAGS "${CURL_CFLAG_SYMBOLS_HIDE}")
+ set_property(TARGET ${LIB_SHARED} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_HIDDEN_SYMBOLS")
endif()
if(CURL_HAS_LTO)
set_target_properties(${LIB_SHARED} PROPERTIES