Skip to content

Commit eee18de

Browse files
authored
build: try to prevent use of static libraries on <5.5
Static library support is experimentally supported on main, which this project takes advantage of. Be a bit more careful about enabling the support to try to keep builds with 5.4.x working. Fixes: #628
1 parent 46e5e3d commit eee18de

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,10 @@ message("-- Swift/COM rG${SWIFT_COM_GIT_REVISION}")
6262
message("-- swift-log rG${SWIFT_LOG_GIT_REVISION}")
6363
message("-- Collections rG${COLLECTIONS_GIT_REVISION}")
6464

65-
export(TARGETS SwiftCOM SwiftWin32
66-
FILE SwiftWin32Config.cmake)
65+
if(Swift_COMPILER_VERSION VERSION_LESS 5.5)
66+
export(TARGETS Logging SwiftCOM SwiftWin32
67+
FILE SwiftWin32Config.cmake)
68+
else()
69+
export(TARGETS SwiftCOM SwiftWin32
70+
FILE SwiftWin32Config.cmake)
71+
endif()

Sources/CMakeLists.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,17 @@ _install_target(SwiftCOM)
3131

3232
file(GLOB LOGGING_SOURCES
3333
${PROJECT_SOURCE_DIR}/Packages/swift-log/Sources/Logging/*.swift)
34-
add_library(Logging STATIC
35-
${LOGGING_SOURCES})
34+
# FIXME(compnerd) 5.5 does not officially support static libraries on Windows
35+
# either. The support requires a version strictly greater than 5.5. Once the
36+
# branch is introduced, adjust this accordingly.
37+
if(Swift_COMPILER_VERSION VERSION_LESS 5.5)
38+
add_library(Logging SHARED
39+
${LOGGING_SOURCES})
40+
_install_target(Logging)
41+
else()
42+
add_library(Logging STATIC
43+
${LOGGING_SOURCES})
44+
endif()
3645

3746
add_subdirectory(SwiftWin32)
3847
add_subdirectory(SwiftWin32UI)

0 commit comments

Comments
 (0)