Skip to content

Commit 2deec47

Browse files
authored
Merge pull request #2596 from compnerd/linking-cleanup
build: cleanup some of the link rules
2 parents 62809e9 + 7328855 commit 2deec47

File tree

4 files changed

+14
-277
lines changed

4 files changed

+14
-277
lines changed

CMakeLists.txt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,6 @@ endif()
2626

2727
option(BUILD_SHARED_LIBS "build shared libraries" ON)
2828

29-
find_package(CURL CONFIG)
30-
if(CURL_FOUND)
31-
include(CMakeExpandImportedTargets)
32-
cmake_expand_imported_targets(CURL_LIBRARIES LIBRARIES CURL::libcurl)
33-
else()
34-
find_package(CURL REQUIRED)
35-
endif()
36-
find_package(ICU COMPONENTS uc i18n REQUIRED)
37-
find_package(LibXml2 REQUIRED)
3829
find_package(dispatch CONFIG REQUIRED)
3930

4031
include(SwiftSupport)

CoreFoundation/CMakeLists.txt

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,7 @@ target_compile_definitions(CoreFoundation
379379
$<$<COMPILE_LANGUAGE:ASM>:CF_CHARACTERSET_UNICODE_DATA_L="CharacterSets/CFUnicodeData-L.mapping">)
380380
target_include_directories(CoreFoundation
381381
PRIVATE
382-
${PROJECT_SOURCE_DIR}
383-
${ICU_INCLUDE_DIR})
382+
${PROJECT_SOURCE_DIR})
384383
target_link_libraries(CoreFoundation PRIVATE
385384
Threads::Threads
386385
${CMAKE_DL_LIBS}
@@ -390,6 +389,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL Android)
390389
target_link_libraries(CoreFoundation PRIVATE
391390
log)
392391
endif()
392+
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
393+
target_link_libraries(CoreFoundation PRIVATE
394+
ICU::uc
395+
ICU::i18n)
396+
endif()
393397

394398
add_framework(CFURLSessionInterface
395399
${FRAMEWORK_LIBRARY_TYPE}
@@ -409,10 +413,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL Windows)
409413
PRIVATE
410414
CURL_STATICLIB)
411415
endif()
412-
target_include_directories(CFURLSessionInterface PRIVATE
413-
${CURL_INCLUDE_DIRS})
414-
target_link_libraries(CFURLSessionInterface PRIVATE
415-
${CURL_LIBRARIES})
416+
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
417+
target_link_libraries(CFURLSessionInterface PRIVATE
418+
CURL::libcurl)
419+
endif()
416420

417421
add_framework(CFXMLInterface
418422
${FRAMEWORK_LIBRARY_TYPE}
@@ -427,10 +431,10 @@ add_framework(CFXMLInterface
427431
SOURCES
428432
Parsing.subproj/CFXMLInterface.c)
429433
add_dependencies(CFXMLInterface CoreFoundation)
430-
target_include_directories(CFXMLInterface PRIVATE
431-
${LIBXML2_INCLUDE_DIR})
432-
target_link_libraries(CFXMLInterface PRIVATE
433-
${LIBXML2_LIBRARIES})
434+
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
435+
target_link_libraries(CFXMLInterface PRIVATE
436+
LibXml2::LibXml2)
437+
endif()
434438

435439
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
436440
add_library(CoreFoundationResources OBJECT

CoreFoundation/cmake/modules/FindICU.cmake

Lines changed: 0 additions & 251 deletions
This file was deleted.

Foundation/CMakeLists.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,6 @@ target_compile_definitions(Foundation PRIVATE
140140
DEPLOYMENT_RUNTIME_SWIFT)
141141
target_compile_options(Foundation PUBLIC
142142
"SHELL:-Xcc -F${CMAKE_BINARY_DIR}")
143-
target_compile_options(Foundation PRIVATE
144-
"SHELL:-Xcc -I${ICU_INCLUDE_DIR}")
145143
if(CMAKE_SYSTEM_NAME STREQUAL Windows AND CMAKE_VERSION VERSION_LESS 3.16)
146144
# Work around for CMake 15 which doesn't link in the resource file
147145
# target properly
@@ -153,8 +151,6 @@ if(ENABLE_TESTING)
153151
-enable-testing)
154152
endif()
155153
target_link_libraries(Foundation PRIVATE
156-
${ICU_UC_LIBRARY}
157-
${ICU_I18N_LIBRARY}
158154
CoreFoundation
159155
uuid)
160156
target_link_libraries(Foundation PUBLIC
@@ -219,8 +215,6 @@ if(ENABLE_TESTING)
219215
-enable-testing)
220216
endif()
221217
target_link_libraries(FoundationNetworking PRIVATE
222-
${CURL_LIBRARIES}
223-
${ZLIB_LIBRARIES}
224218
Foundation
225219
CFURLSessionInterface)
226220
set_target_properties(FoundationNetworking PROPERTIES
@@ -245,7 +239,6 @@ if(ENABLE_TESTING)
245239
-enable-testing)
246240
endif()
247241
target_link_libraries(FoundationXML PRIVATE
248-
${LIBXML2_LIBRARIES}
249242
Foundation
250243
CFXMLInterface)
251244
set_target_properties(FoundationXML PROPERTIES

0 commit comments

Comments
 (0)