Skip to content

Commit 2a89813

Browse files
authored
CMake: Make SourceControl a shared library (#8124)
### Motivation: The current CMake build results in duplicate definitions across the resulting shared libraries, resulting in warnings on macOS at runtime. ### Modifications: * Make `SourceControl` a shared library. The library is shared across multiple other libraries (`Commands`, `PackageGraph` and `PackageLoading`), resulting in duplicate definitions in shared libraries. ### Result: No more warning at runtime with a macOS build.
1 parent da23eab commit 2a89813

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Sources/SourceControl/CMakeLists.txt

+7-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# See http://swift.org/LICENSE.txt for license information
77
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
88

9-
add_library(SourceControl STATIC
9+
add_library(SourceControl
1010
GitRepository.swift
1111
Repository.swift
1212
RepositoryManager.swift)
@@ -20,3 +20,9 @@ target_link_libraries(SourceControl PUBLIC
2020
# NOTE(compnerd) workaround for CMake not setting up include flags yet
2121
set_target_properties(SourceControl PROPERTIES
2222
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
23+
24+
install(TARGETS SourceControl
25+
ARCHIVE DESTINATION lib
26+
LIBRARY DESTINATION lib
27+
RUNTIME DESTINATION bin)
28+
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS SourceControl)

0 commit comments

Comments
 (0)