From 05076bc7e8e5bc56f1cbb3c50021de8c168a7cd9 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Sun, 27 Feb 2022 10:41:35 -0800 Subject: [PATCH] build: statically link ArgumentParserToolInfo always 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. --- Sources/ArgumentParserToolInfo/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Sources/ArgumentParserToolInfo/CMakeLists.txt b/Sources/ArgumentParserToolInfo/CMakeLists.txt index e3a6c23ea..b82adb71d 100644 --- a/Sources/ArgumentParserToolInfo/CMakeLists.txt +++ b/Sources/ArgumentParserToolInfo/CMakeLists.txt @@ -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 @@ -7,5 +7,4 @@ target_compile_options(ArgumentParserToolInfo PRIVATE $<$:-enable-testing>) -_install_target(ArgumentParserToolInfo) set_property(GLOBAL APPEND PROPERTY ArgumentParser_EXPORTS ArgumentParserToolInfo)