Skip to content

Added option to enable CMake Install #2907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ else()
endif()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

option(BUILD_SHARED_LIBS "Build shared libraryes by default" YES)
option(BUILD_SHARED_LIBS "Build shared libraries by default" YES)

string(COMPARE EQUAL ${CMAKE_SYSTEM_NAME} Windows CMAKE_INSTALL_DEFAULT)
option(USE_CMAKE_INSTALL
"Install build products using cmake's install() instead of the bootstrap script's install()"
${CMAKE_INSTALL_DEFAULT})

find_package(TSC CONFIG REQUIRED)

Expand Down
2 changes: 1 addition & 1 deletion Sources/Build/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ target_link_libraries(Build PRIVATE
set_target_properties(Build PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})

if(CMAKE_SYSTEM_NAME STREQUAL Windows)
if(USE_CMAKE_INSTALL)
install(TARGETS Build
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
Expand Down
2 changes: 1 addition & 1 deletion Sources/Commands/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ endif()
set_target_properties(Commands PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})

if(CMAKE_SYSTEM_NAME STREQUAL Windows)
if(USE_CMAKE_INSTALL)
install(TARGETS Commands
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
Expand Down
2 changes: 1 addition & 1 deletion Sources/LLBuildManifest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ target_link_libraries(LLBuildManifest PUBLIC
set_target_properties(LLBuildManifest PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})

if(CMAKE_SYSTEM_NAME STREQUAL Windows)
if(USE_CMAKE_INSTALL)
install(TARGETS LLBuildManifest
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
Expand Down
2 changes: 1 addition & 1 deletion Sources/PackageGraph/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ target_link_libraries(PackageGraph PUBLIC
set_target_properties(PackageGraph PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})

if(CMAKE_SYSTEM_NAME STREQUAL Windows)
if(USE_CMAKE_INSTALL)
install(TARGETS PackageGraph
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
Expand Down
2 changes: 1 addition & 1 deletion Sources/PackageLoading/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ target_link_libraries(PackageLoading PUBLIC
set_target_properties(PackageLoading PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})

if(CMAKE_SYSTEM_NAME STREQUAL Windows)
if(USE_CMAKE_INSTALL)
install(TARGETS PackageLoading
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
Expand Down
2 changes: 1 addition & 1 deletion Sources/PackageModel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ target_link_libraries(PackageModel PUBLIC
set_target_properties(PackageModel PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})

if(CMAKE_SYSTEM_NAME STREQUAL Windows)
if(USE_CMAKE_INSTALL)
install(TARGETS PackageModel
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
Expand Down
2 changes: 1 addition & 1 deletion Sources/SPMBuildCore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ target_link_libraries(SPMBuildCore PUBLIC
PackageGraph)


if(CMAKE_SYSTEM_NAME STREQUAL Windows)
if(USE_CMAKE_INSTALL)
install(TARGETS SPMBuildCore
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
Expand Down
3 changes: 1 addition & 2 deletions Sources/SPMLLBuild/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ target_link_libraries(SPMLLBuild PUBLIC
TSCUtility
llbuildSwift)


if(CMAKE_SYSTEM_NAME STREQUAL Windows)
if(USE_CMAKE_INSTALL)
install(TARGETS SPMLLBuild
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
Expand Down
2 changes: 1 addition & 1 deletion Sources/SourceControl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ target_link_libraries(SourceControl PUBLIC
set_target_properties(SourceControl PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})

if(CMAKE_SYSTEM_NAME STREQUAL Windows)
if(USE_CMAKE_INSTALL)
install(TARGETS SourceControl
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
Expand Down
2 changes: 1 addition & 1 deletion Sources/Workspace/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ target_link_libraries(Workspace PUBLIC
set_target_properties(Workspace PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})

if(CMAKE_SYSTEM_NAME STREQUAL Windows)
if(USE_CMAKE_INSTALL)
install(TARGETS Workspace
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
Expand Down
4 changes: 2 additions & 2 deletions Sources/XCBuildSupport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ target_link_libraries(XCBuildSupport PUBLIC
set_target_properties(XCBuildSupport PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})

if(CMAKE_SYSTEM_NAME STREQUAL Windows)
install(TARGETS XCBuildSupport
if(USE_CMAKE_INSTALL)
install(TARGETS XCBuildSupport
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Xcodeproj/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ target_link_libraries(Xcodeproj PUBLIC
set_target_properties(Xcodeproj PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})

if(CMAKE_SYSTEM_NAME STREQUAL Windows)
if(USE_CMAKE_INSTALL)
install(TARGETS Xcodeproj
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
Expand Down
6 changes: 3 additions & 3 deletions Sources/swift-build/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ add_executable(swift-build
target_link_libraries(swift-build PRIVATE
Commands)

if(CMAKE_SYSTEM_NAME STREQUAL Windows)
install(TARGETS swift-build
DESTINATION bin)
if(USE_CMAKE_INSTALL)
install(TARGETS swift-build
DESTINATION bin)
endif()
2 changes: 1 addition & 1 deletion Sources/swift-package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ add_executable(swift-package
target_link_libraries(swift-package PRIVATE
Commands)

if(CMAKE_SYSTEM_NAME STREQUAL Windows)
if(USE_CMAKE_INSTALL)
install(TARGETS swift-package
RUNTIME DESTINATION bin)
endif()
2 changes: 1 addition & 1 deletion Sources/swift-run/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ add_executable(swift-run
target_link_libraries(swift-run PRIVATE
Commands)

if(CMAKE_SYSTEM_NAME STREQUAL Windows)
if(USE_CMAKE_INSTALL)
install(TARGETS swift-run
RUNTIME DESTINATION bin)
endif()
2 changes: 1 addition & 1 deletion Sources/swift-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ add_executable(swift-test
target_link_libraries(swift-test PRIVATE
Commands)

if(CMAKE_SYSTEM_NAME STREQUAL Windows)
if(USE_CMAKE_INSTALL)
install(TARGETS swift-test
RUNTIME DESTINATION bin)
endif()
2 changes: 1 addition & 1 deletion swift-tools-support-core/Sources/TSCBasic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ set_target_properties(TSCBasic PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})


if(CMAKE_SYSTEM_NAME STREQUAL Windows)
if(USE_CMAKE_INSTALL)
install(TARGETS TSCBasic
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
Expand Down
2 changes: 1 addition & 1 deletion swift-tools-support-core/Sources/TSCLibc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set_target_properties(TSCLibc PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})


if(CMAKE_SYSTEM_NAME STREQUAL Windows)
if(USE_CMAKE_INSTALL)
install(TARGETS TSCLibc
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
Expand Down
2 changes: 1 addition & 1 deletion swift-tools-support-core/Sources/TSCUtility/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ endif()
set_target_properties(TSCUtility PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})

if(CMAKE_SYSTEM_NAME STREQUAL Windows)
if(USE_CMAKE_INSTALL)
install(TARGETS TSCUtility
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
Expand Down