Skip to content

Commit

Permalink
build: statically link ArgumentParserToolInfo always
Browse files Browse the repository at this point in the history
Now that windows supports static linking as well (to a certain degree),
alter the build of swift-argument-parser in CMake to use static linking
for ArgumentParserToolInfo always irrespective of whether ArgumentParser
is being built as a static library or a dynamic library.  On Windows, in
release mode, this saves ~32KiB.  Additionally, because no tool directly
links against this library, no binaries are further expanded by static
linking, and we have one less file to distribute.
  • Loading branch information
compnerd committed Mar 20, 2022
1 parent 8290528 commit 05076bc
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Sources/ArgumentParserToolInfo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_library(ArgumentParserToolInfo
add_library(ArgumentParserToolInfo STATIC
ToolInfo.swift)
# NOTE: workaround for CMake not setting up include flags yet
set_target_properties(ArgumentParserToolInfo PROPERTIES
Expand All @@ -7,5 +7,4 @@ target_compile_options(ArgumentParserToolInfo PRIVATE
$<$<BOOL:${BUILD_TESTING}>:-enable-testing>)


_install_target(ArgumentParserToolInfo)
set_property(GLOBAL APPEND PROPERTY ArgumentParser_EXPORTS ArgumentParserToolInfo)

0 comments on commit 05076bc

Please sign in to comment.