Skip to content

Commit 51e25fc

Browse files
committed
build: clean up some unnecessary conditions
The dependencies on Foundation are effectively required on all non-Darwin platforms. Unconditionalize them and force the link against the libraries irrespective of whether they are wired up to the build or rely on the default linker search path.
1 parent 05c4d01 commit 51e25fc

File tree

5 files changed

+10
-22
lines changed

5 files changed

+10
-22
lines changed

Sources/Commands/CMakeLists.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,8 @@ target_link_libraries(Commands PUBLIC
4343
Workspace
4444
XCBuildSupport
4545
Xcodeproj)
46-
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
47-
if(Foundation_FOUND)
48-
target_link_libraries(Commands PUBLIC
49-
FoundationXML)
50-
endif()
51-
endif()
46+
target_link_libraries(Commands PRIVATE
47+
$<$<NOT:$<PLATFORM_ID:Darwin>>:FoundationXML>)
5248
# NOTE(compnerd) workaround for CMake not setting up include flags yet
5349
set_target_properties(Commands PROPERTIES
5450
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})

Sources/PackageDescription/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,8 @@ set_target_properties(PackageDescription PROPERTIES
4747
)
4848

4949
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
50-
if(Foundation_FOUND)
51-
target_link_libraries(PackageDescription PRIVATE
52-
Foundation)
53-
endif()
50+
target_link_libraries(PackageDescription PRIVATE
51+
Foundation)
5452
target_link_options(PackageDescription PRIVATE
5553
"SHELL:-no-toolchain-stdlib-rpath")
5654
set_target_properties(PackageDescription PROPERTIES

Sources/PackageLoading/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ target_link_libraries(PackageLoading PUBLIC
2626
PackageModel
2727
SourceControl
2828
TSCUtility)
29-
if(Foundation_FOUND)
30-
target_link_libraries(PackageLoading PUBLIC
31-
$<$<NOT:$<PLATFORM_ID:Darwin>>:Foundation>)
32-
endif()
29+
target_link_libraries(PackageLoading PUBLIC
30+
$<$<NOT:$<PLATFORM_ID:Darwin>>:Foundation>)
3331
# NOTE(compnerd) workaround for CMake not setting up include flags yet
3432
set_target_properties(PackageLoading PROPERTIES
3533
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})

Sources/PackagePlugin/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,8 @@ set_target_properties(PackagePlugin PROPERTIES
4646
)
4747

4848
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
49-
if(Foundation_FOUND)
50-
target_link_libraries(PackagePlugin PRIVATE
51-
Foundation)
52-
endif()
49+
target_link_libraries(PackagePlugin PRIVATE
50+
Foundation)
5351
target_link_options(PackagePlugin PRIVATE
5452
"SHELL:-no-toolchain-stdlib-rpath")
5553
set_target_properties(PackagePlugin PROPERTIES

Sources/Workspace/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@ target_link_libraries(Workspace PUBLIC
3636
PackageModel
3737
SourceControl
3838
Xcodeproj)
39-
if(Foundation_FOUND)
40-
target_link_libraries(PackageLoading PUBLIC
41-
$<$<NOT:$<PLATFORM_ID:Darwin>>:Foundation>)
42-
endif()
39+
target_link_libraries(PackageLoading PUBLIC
40+
$<$<NOT:$<PLATFORM_ID:Darwin>>:Foundation>)
4341
# NOTE(compnerd) workaround for CMake not setting up include flags yet
4442
set_target_properties(Workspace PROPERTIES
4543
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})

0 commit comments

Comments
 (0)