diff --git a/CMakeLists.txt b/CMakeLists.txt index 45faa45826..62b22af84d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,11 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift) +# Optionally build tools (on by default) but only when building shared libraries +if(BUILD_SHARED_LIBS) + option(FOUNDATION_BUILD_TOOLS "build tools" ON) +endif() + set(CMAKE_POSITION_INDEPENDENT_CODE YES) # Fetchable dependcies diff --git a/Sources/CMakeLists.txt b/Sources/CMakeLists.txt index 457edf4d2b..0ee266a4bc 100644 --- a/Sources/CMakeLists.txt +++ b/Sources/CMakeLists.txt @@ -18,3 +18,6 @@ add_subdirectory(_CFURLSessionInterface) add_subdirectory(Foundation) add_subdirectory(FoundationXML) add_subdirectory(FoundationNetworking) +if(FOUNDATION_BUILD_TOOLS) + add_subdirectory(plutil) +endif() diff --git a/Sources/plutil/CMakeLists.txt b/Sources/plutil/CMakeLists.txt new file mode 100644 index 0000000000..a6795e6894 --- /dev/null +++ b/Sources/plutil/CMakeLists.txt @@ -0,0 +1,29 @@ +##===----------------------------------------------------------------------===## +## +## This source file is part of the Swift open source project +## +## Copyright (c) 2024 Apple Inc. and the Swift project authors +## Licensed under Apache License v2.0 +## +## See LICENSE.txt for license information +## See CONTRIBUTORS.md for the list of Swift project authors +## +## SPDX-License-Identifier: Apache-2.0 +## +##===----------------------------------------------------------------------===## + +add_executable(plutil + main.swift) + +target_link_libraries(plutil PRIVATE + Foundation) + +target_link_options(plutil PRIVATE + "SHELL:-no-toolchain-stdlib-rpath") + +set_target_properties(plutil PROPERTIES + INSTALL_RPATH "$ORIGIN/../lib/swift/${SWIFT_SYSTEM_NAME}") + +set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS plutil) +install(TARGETS plutil + DESTINATION ${CMAKE_INSTALL_BINDIR})