VirtualBox

source: vbox/trunk/src/libs/curl-7.87.0/lib/CMakeLists.txt@ 98341

最後變更 在這個檔案從98341是 98326,由 vboxsync 提交於 2 年 前

curl-7.87.0: Applied and adjusted our curl changes to 7.83.1. bugref:10356

  • 屬性 svn:eol-style 設為 native
檔案大小: 5.1 KB
 
1#***************************************************************************
2# _ _ ____ _
3# Project ___| | | | _ \| |
4# / __| | | | |_) | |
5# | (__| |_| | _ <| |___
6# \___|\___/|_| \_\_____|
7#
8# Copyright (C) 1998 - 2022, Daniel Stenberg, <[email protected]>, et al.
9#
10# This software is licensed as described in the file COPYING, which
11# you should have received as part of this distribution. The terms
12# are also available at https://curl.se/docs/copyright.html.
13#
14# You may opt to use, copy, modify, merge, publish, distribute and/or sell
15# copies of the Software, and permit persons to whom the Software is
16# furnished to do so, under the terms of the COPYING file.
17#
18# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19# KIND, either express or implied.
20#
21# SPDX-License-Identifier: curl
22#
23###########################################################################
24set(LIB_NAME libcurl)
25set(LIBCURL_OUTPUT_NAME libcurl CACHE STRING "Basename of the curl library")
26add_definitions(-DBUILDING_LIBCURL)
27
28if(BUILD_SHARED_LIBS)
29 set(CURL_STATICLIB NO)
30else()
31 set(CURL_STATICLIB YES)
32endif()
33
34# Use:
35# * CURL_STATICLIB
36configure_file(curl_config.h.cmake
37 ${CMAKE_CURRENT_BINARY_DIR}/curl_config.h)
38
39transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
40include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
41
42list(APPEND HHEADERS
43 ${CMAKE_CURRENT_BINARY_DIR}/curl_config.h
44 )
45
46if(WIN32 AND NOT CURL_STATICLIB)
47 list(APPEND CSOURCES libcurl.rc)
48endif()
49
50# SET(CSOURCES
51# # memdebug.c -not used
52# # nwlib.c - Not used
53# # strtok.c - specify later
54# # strtoofft.c - specify later
55# )
56
57# #OPTION(CURL_MALLOC_DEBUG "Debug mallocs in Curl" OFF)
58# MARK_AS_ADVANCED(CURL_MALLOC_DEBUG)
59# IF(CURL_MALLOC_DEBUG)
60# SET(CSOURCES ${CSOURCES}
61# memdebug.c
62# )
63# ENDIF(CURL_MALLOC_DEBUG)
64
65# # only build compat strtoofft if we need to
66# IF(NOT HAVE_STRTOLL AND NOT HAVE__STRTOI64)
67# SET(CSOURCES ${CSOURCES}
68# strtoofft.c
69# )
70# ENDIF(NOT HAVE_STRTOLL AND NOT HAVE__STRTOI64)
71
72
73# The rest of the build
74
75include_directories(${CMAKE_CURRENT_BINARY_DIR}/../include)
76include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
77include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../include)
78include_directories(${CMAKE_CURRENT_BINARY_DIR}/..)
79include_directories(${CMAKE_CURRENT_SOURCE_DIR})
80include_directories(${CMAKE_CURRENT_BINARY_DIR})
81if(USE_ARES)
82 include_directories(${CARES_INCLUDE_DIR})
83endif()
84
85add_library(
86 ${LIB_NAME}
87 ${HHEADERS} ${CSOURCES}
88 )
89
90add_library(
91 ${PROJECT_NAME}::${LIB_NAME}
92 ALIAS ${LIB_NAME}
93 )
94
95if(NOT BUILD_SHARED_LIBS)
96 set_target_properties(${LIB_NAME} PROPERTIES INTERFACE_COMPILE_DEFINITIONS CURL_STATICLIB)
97endif()
98
99target_link_libraries(${LIB_NAME} PRIVATE ${CURL_LIBS})
100
101transform_makefile_inc("Makefile.soname" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.soname.cmake")
102include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.soname.cmake)
103
104set_target_properties(${LIB_NAME} PROPERTIES
105 COMPILE_DEFINITIONS BUILDING_LIBCURL
106 OUTPUT_NAME ${LIBCURL_OUTPUT_NAME}
107 )
108
109if(CMAKE_SYSTEM_NAME STREQUAL "AIX" OR
110 CMAKE_SYSTEM_NAME STREQUAL "Linux" OR
111 CMAKE_SYSTEM_NAME STREQUAL "GNU/kFreeBSD" OR
112
113 # FreeBSD comes with the a.out and elf flavours
114 # but a.out was supported up to version 3.x and
115 # elf from 3.x. I cannot imagine someone runnig
116 # CMake on those ancient systems
117 CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR
118
119 CMAKE_SYSTEM_NAME STREQUAL "Haiku")
120
121 math(EXPR CMAKESONAME "${VERSIONCHANGE} - ${VERSIONDEL}")
122 set(CMAKEVERSION "${CMAKESONAME}.${VERSIONDEL}.${VERSIONADD}")
123
124 set_target_properties(${LIB_NAME} PROPERTIES
125 VERSION ${CMAKEVERSION}
126 SOVERSION ${CMAKESONAME}
127 )
128
129endif()
130
131
132if(HIDES_CURL_PRIVATE_SYMBOLS)
133 set_property(TARGET ${LIB_NAME} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_HIDDEN_SYMBOLS")
134 set_property(TARGET ${LIB_NAME} APPEND PROPERTY COMPILE_FLAGS ${CURL_CFLAG_SYMBOLS_HIDE})
135endif()
136
137# Remove the "lib" prefix since the library is already named "libcurl".
138set_target_properties(${LIB_NAME} PROPERTIES PREFIX "")
139set_target_properties(${LIB_NAME} PROPERTIES IMPORT_PREFIX "")
140
141if(CURL_HAS_LTO)
142 set_target_properties(${LIB_NAME} PROPERTIES
143 INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE
144 INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE)
145endif()
146
147if(WIN32)
148 if(BUILD_SHARED_LIBS)
149 if(MSVC)
150 # Add "_imp" as a suffix before the extension to avoid conflicting with
151 # the statically linked "libcurl.lib"
152 set_target_properties(${LIB_NAME} PROPERTIES IMPORT_SUFFIX "_imp.lib")
153 endif()
154 endif()
155endif()
156
157target_include_directories(${LIB_NAME} INTERFACE
158 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
159 $<BUILD_INTERFACE:${CURL_SOURCE_DIR}/include>)
160
161if(CURL_ENABLE_EXPORT_TARGET)
162 install(TARGETS ${LIB_NAME}
163 EXPORT ${TARGETS_EXPORT_NAME}
164 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
165 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
166 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
167 )
168
169 export(TARGETS ${LIB_NAME}
170 FILE ${PROJECT_BINARY_DIR}/libcurl-target.cmake
171 NAMESPACE ${PROJECT_NAME}::
172 )
173endif()
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette