diff options
author | Curl Upstream <curl-library@lists.haxx.se> | 2024-07-24 06:20:43 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-07-25 15:03:51 (GMT) |
commit | 8defd39611e68f5afe612e9351c6f6b8a19eb5ff (patch) | |
tree | cac58917b75a6b0799545422467c440482dce82e /lib/CMakeLists.txt | |
parent | 9f46cdb65da8f66c9894ff55ab59ebe8a4058538 (diff) | |
download | CMake-8defd39611e68f5afe612e9351c6f6b8a19eb5ff.zip CMake-8defd39611e68f5afe612e9351c6f6b8a19eb5ff.tar.gz CMake-8defd39611e68f5afe612e9351c6f6b8a19eb5ff.tar.bz2 |
curl 2024-07-24 (5040f7e9)
Code extracted from:
https://github.com/curl/curl.git
at commit 5040f7e94cd01decbe7ba8fdacbf489182d503dc (curl-8_9_0).
Diffstat (limited to 'lib/CMakeLists.txt')
-rw-r--r-- | lib/CMakeLists.txt | 65 |
1 files changed, 32 insertions, 33 deletions
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index e80df5f..63e5b91 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -65,29 +65,6 @@ if(ENABLE_CURLDEBUG) set_source_files_properties(memdebug.c curl_multibyte.c PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON) endif() -transform_makefile_inc("Makefile.soname" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.soname.cmake") -include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.soname.cmake) - -if(CMAKE_SYSTEM_NAME STREQUAL "AIX" OR - CMAKE_SYSTEM_NAME STREQUAL "Linux" OR - CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR - CMAKE_SYSTEM_NAME STREQUAL "SunOS" OR - CMAKE_SYSTEM_NAME STREQUAL "GNU/kFreeBSD" OR - - # FreeBSD comes with the a.out and elf flavours - # but a.out was supported up to version 3.x and - # elf from 3.x. I cannot imagine someone running - # CMake on those ancient systems - CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR - - CMAKE_SYSTEM_NAME STREQUAL "Haiku") - - math(EXPR CMAKESONAME "${VERSIONCHANGE} - ${VERSIONDEL}") - set(CMAKEVERSION "${CMAKESONAME}.${VERSIONDEL}.${VERSIONADD}") -else() - unset(CMAKESONAME) -endif() - ## Library definition # Add "_imp" as a suffix before the extension to avoid conflicting with @@ -169,10 +146,6 @@ if(BUILD_STATIC_LIBS) INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE) endif() - if(CMAKEVERSION AND CMAKESONAME) - set_target_properties(${LIB_STATIC} PROPERTIES - VERSION ${CMAKEVERSION} SOVERSION ${CMAKESONAME}) - endif() target_include_directories(${LIB_STATIC} INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> @@ -185,8 +158,8 @@ if(BUILD_SHARED_LIBS) add_library(${PROJECT_NAME}::${LIB_SHARED} ALIAS ${LIB_SHARED}) if(WIN32 OR CYGWIN) if(CYGWIN) - # For cygwin always compile dllmain.c as a separate unit since it - # includes windows.h, which shouldn't be included in other units. + # For Cygwin always compile dllmain.c as a separate unit since it + # includes windows.h, which should not be included in other units. set_source_files_properties(dllmain.c PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON) endif() @@ -213,14 +186,40 @@ if(BUILD_SHARED_LIBS) INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE) endif() - if(CMAKEVERSION AND CMAKESONAME) - set_target_properties(${LIB_SHARED} PROPERTIES - VERSION ${CMAKEVERSION} SOVERSION ${CMAKESONAME}) - endif() target_include_directories(${LIB_SHARED} INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CURL_SOURCE_DIR}/include>) + + if(CMAKE_DLL_NAME_WITH_SOVERSION OR + CYGWIN OR + APPLE OR + CMAKE_SYSTEM_NAME STREQUAL "AIX" OR + CMAKE_SYSTEM_NAME STREQUAL "Linux" OR + CMAKE_SYSTEM_NAME STREQUAL "SunOS" OR + CMAKE_SYSTEM_NAME STREQUAL "Haiku" OR + CMAKE_SYSTEM_NAME STREQUAL "GNU/kFreeBSD" OR + # FreeBSD comes with the a.out and ELF flavours but a.out was supported + # up to v3.x and ELF from v3.x. I cannot imagine someone running CMake + # on those ancient systems. + CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + set(soversion_default TRUE) + else() + set(soversion_default FALSE) + endif() + + option(CURL_LIBCURL_SOVERSION "Enable libcurl SOVERSION" ${soversion_default}) + + if(CURL_LIBCURL_SOVERSION) + transform_makefile_inc("Makefile.soname" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.soname.cmake") + include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.soname.cmake) + + math(EXPR CMAKESONAME "${VERSIONCHANGE} - ${VERSIONDEL}") + set(CMAKEVERSION "${CMAKESONAME}.${VERSIONDEL}.${VERSIONADD}") + + set_target_properties(${LIB_SHARED} PROPERTIES + VERSION "${CMAKEVERSION}" SOVERSION "${CMAKESONAME}") + endif() endif() add_library(${LIB_NAME} ALIAS ${LIB_SELECTED}) |