Skip to content

Commit a16c71c

Browse files
committed
[CMake] Remove TARGET_LIBRARY option from add_swift_target_library
If you're calling add_swift_target_library, you already know it's a target library.
1 parent 7767d07 commit a16c71c

File tree

9 files changed

+11
-24
lines changed

9 files changed

+11
-24
lines changed

CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,8 +1065,7 @@ endif()
10651065
#
10661066
# We must include stdlib/ before tools/ because stdlib/CMakeLists.txt
10671067
# declares the swift-stdlib-* set of targets. These targets will then
1068-
# implicitly depend on any targets declared with IS_STDLIB or
1069-
# TARGET_LIBRARY.
1068+
# implicitly depend on any targets declared with IS_STDLIB.
10701069
#
10711070
# One such library that declares IS_STDLIB is SwiftSyntax, living in
10721071
# tools/SwiftSyntax. If we include stdlib/ after tools/,

cmake/modules/AddSwift.cmake

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,7 +1549,6 @@ endfunction()
15491549
# [INSTALL]
15501550
# [IS_STDLIB]
15511551
# [IS_STDLIB_CORE]
1552-
# [TARGET_LIBRARY]
15531552
# [INSTALL_WITH_SHARED]
15541553
# INSTALL_IN_COMPONENT comp
15551554
# DEPLOYMENT_VERSION_OSX version
@@ -1630,17 +1629,13 @@ endfunction()
16301629
#
16311630
# IS_STDLIB
16321631
# Treat the library as a part of the Swift standard library.
1633-
# IS_STDLIB implies TARGET_LIBRARY.
16341632
#
16351633
# IS_STDLIB_CORE
16361634
# Compile as the Swift standard library core.
16371635
#
16381636
# IS_SDK_OVERLAY
16391637
# Treat the library as a part of the Swift SDK overlay.
1640-
# IS_SDK_OVERLAY implies TARGET_LIBRARY and IS_STDLIB.
1641-
#
1642-
# TARGET_LIBRARY
1643-
# Build library for the target SDKs.
1638+
# IS_SDK_OVERLAY implies IS_STDLIB.
16441639
#
16451640
# INSTALL_IN_COMPONENT comp
16461641
# The Swift installation component that this library belongs to.
@@ -1674,7 +1669,6 @@ function(add_swift_target_library name)
16741669
OBJECT_LIBRARY
16751670
SHARED
16761671
STATIC
1677-
TARGET_LIBRARY
16781672
INSTALL_WITH_SHARED)
16791673
set(SWIFTLIB_single_parameter_options
16801674
DEPLOYMENT_VERSION_IOS
@@ -1727,7 +1721,6 @@ function(add_swift_target_library name)
17271721
if(SWIFTLIB_IS_SDK_OVERLAY)
17281722
set(SWIFTLIB_HAS_SWIFT_CONTENT TRUE)
17291723
set(SWIFTLIB_IS_STDLIB TRUE)
1730-
set(SWIFTLIB_TARGET_LIBRARY TRUE)
17311724

17321725
# Install to sdk-overlay by default, but don't hardcode it
17331726
if(NOT SWIFTLIB_INSTALL_IN_COMPONENT)
@@ -1738,7 +1731,6 @@ function(add_swift_target_library name)
17381731
# Standard library is always a target library.
17391732
if(SWIFTLIB_IS_STDLIB)
17401733
set(SWIFTLIB_HAS_SWIFT_CONTENT TRUE)
1741-
set(SWIFTLIB_TARGET_LIBRARY TRUE)
17421734
endif()
17431735

17441736
# If target SDKs are not specified, build for all known SDKs.
@@ -1778,9 +1770,6 @@ function(add_swift_target_library name)
17781770
"Either SHARED, STATIC, or OBJECT_LIBRARY must be specified")
17791771
endif()
17801772

1781-
precondition(SWIFTLIB_TARGET_LIBRARY
1782-
MESSAGE "TARGET_LIBRARY not inferred in add_swift_target_library?!")
1783-
17841773
# In the standard library and overlays, warn about implicit overrides
17851774
# as a reminder to consider when inherited protocols need different
17861775
# behavior for their requirements.
@@ -1972,6 +1961,7 @@ function(add_swift_target_library name)
19721961
${SWIFTLIB_OBJECT_LIBRARY_keyword}
19731962
${SWIFTLIB_INSTALL_WITH_SHARED_keyword}
19741963
${SWIFTLIB_SOURCES}
1964+
TARGET_LIBRARY
19751965
MODULE_TARGET ${MODULE_VARIANT_NAME}
19761966
SDK ${sdk}
19771967
ARCHITECTURE ${arch}
@@ -1991,7 +1981,6 @@ function(add_swift_target_library name)
19911981
${SWIFTLIB_IS_STDLIB_keyword}
19921982
${SWIFTLIB_IS_STDLIB_CORE_keyword}
19931983
${SWIFTLIB_IS_SDK_OVERLAY_keyword}
1994-
${SWIFTLIB_TARGET_LIBRARY_keyword}
19951984
${SWIFTLIB_FORCE_BUILD_OPTIMIZED_keyword}
19961985
${SWIFTLIB_NOSWIFTRT_keyword}
19971986
DARWIN_INSTALL_NAME_DIR "${SWIFTLIB_DARWIN_INSTALL_NAME_DIR}"

stdlib/private/OSLog/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
add_swift_target_library(swiftOSLogPrototype
22
IS_SDK_OVERLAY
33
SHARED
4-
TARGET_LIBRARY
54

65
OSLog.swift
76
OSLogMessage.swift

stdlib/public/Reflection/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ if (LLVM_ENABLE_ASSERTIONS)
2020
endif(LLVM_ENABLE_ASSERTIONS)
2121

2222
if(SWIFT_BUILD_STDLIB)
23-
add_swift_target_library(swiftReflection STATIC TARGET_LIBRARY
23+
add_swift_target_library(swiftReflection STATIC
2424
${swiftReflection_SOURCES}
2525
C_COMPILE_FLAGS ${SWIFT_RUNTIME_CXX_FLAGS} -DswiftCore_EXPORTS
2626
LINK_FLAGS ${SWIFT_RUNTIME_LINK_FLAGS}

stdlib/public/SwiftRemoteMirror/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# always built as a shared library.
33
if(SWIFT_BUILD_DYNAMIC_STDLIB)
44
add_swift_target_library(swiftRemoteMirror
5-
SHARED TARGET_LIBRARY DONT_EMBED_BITCODE NOSWIFTRT
5+
SHARED DONT_EMBED_BITCODE NOSWIFTRT
66
SwiftRemoteMirror.cpp
77
LINK_LIBRARIES
88
swiftReflection

stdlib/public/runtime/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ if(SWIFT_BUILD_STATIC_STDLIB AND "${sdk}" STREQUAL "LINUX")
9494
string(TOLOWER "${sdk}" lowercase_sdk)
9595

9696
# These two libraries are only used with the static swiftcore
97-
add_swift_target_library(swiftImageInspectionShared TARGET_LIBRARY STATIC
97+
add_swift_target_library(swiftImageInspectionShared STATIC
9898
ImageInspectionELF.cpp
9999
C_COMPILE_FLAGS ${swift_runtime_library_compile_flags}
100100
LINK_FLAGS ${swift_runtime_linker_flags}
@@ -151,15 +151,15 @@ if(SWIFT_BUILD_STATIC_STDLIB AND "${sdk}" STREQUAL "LINUX")
151151
endforeach()
152152
add_dependencies(static_binary_magic ${swift_image_inspection_static_primary_arch})
153153

154-
add_swift_target_library(swiftImageInspectionSharedObject OBJECT_LIBRARY TARGET_LIBRARY
154+
add_swift_target_library(swiftImageInspectionSharedObject OBJECT_LIBRARY
155155
ImageInspectionELF.cpp
156156
C_COMPILE_FLAGS ${swift_runtime_library_compile_flags}
157157
LINK_FLAGS ${swift_runtime_linker_flags}
158158
SWIFT_COMPILE_FLAGS ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
159159
INSTALL_IN_COMPONENT never_install)
160160
endif()
161161

162-
add_swift_target_library(swiftRuntime OBJECT_LIBRARY TARGET_LIBRARY
162+
add_swift_target_library(swiftRuntime OBJECT_LIBRARY
163163
${swift_runtime_sources}
164164
${swift_runtime_objc_sources}
165165
${swift_runtime_leaks_sources}

stdlib/public/stubs/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ list(APPEND swift_stubs_c_compile_flags -DswiftCore_EXPORTS)
2828
list(APPEND swift_stubs_c_compile_flags -I${SWIFT_SOURCE_DIR}/include)
2929

3030
add_swift_target_library(swiftStdlibStubs
31-
OBJECT_LIBRARY TARGET_LIBRARY
31+
OBJECT_LIBRARY
3232
${swift_stubs_sources}
3333
${swift_stubs_objc_sources}
3434
${swift_stubs_unicode_normalization_sources}

stdlib/toolchain/Compatibility50/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
set(library_name "swiftCompatibility50")
22

3-
add_swift_target_library("${library_name}" STATIC TARGET_LIBRARY
3+
add_swift_target_library("${library_name}" STATIC
44
ProtocolConformance.cpp
55
Overrides.cpp
66

stdlib/toolchain/CompatibilityDynamicReplacements/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
set(library_name "swiftCompatibilityDynamicReplacements")
22

3-
add_swift_target_library("${library_name}" STATIC TARGET_LIBRARY
3+
add_swift_target_library("${library_name}" STATIC
44
DynamicReplaceable.cpp
55

66
TARGET_SDKS ${SWIFT_APPLE_PLATFORMS}

0 commit comments

Comments
 (0)