Skip to content

[CMake] Require SWIFT_COMPONENT for add_swift_host_tool #21326

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
Dec 15, 2018
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
26 changes: 13 additions & 13 deletions cmake/modules/AddSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2322,26 +2322,26 @@ function(add_swift_host_tool executable)
"${ADDSWIFTHOSTTOOL_multiple_parameter_options}" # multi-value args
${ARGN})

precondition(ADDSWIFTHOSTTOOL_SWIFT_COMPONENT
MESSAGE "Swift Component is required to add a host tool")

# Create the executable rule.
add_swift_executable(
${executable}
${ADDSWIFTHOSTTOOL_UNPARSED_ARGUMENTS}
)

# And then create the install rule if we are asked to.
if (ADDSWIFTHOSTTOOL_SWIFT_COMPONENT)
swift_install_in_component(${ADDSWIFTHOSTTOOL_SWIFT_COMPONENT}
TARGETS ${executable}
RUNTIME DESTINATION bin)
swift_install_in_component(${ADDSWIFTHOSTTOOL_SWIFT_COMPONENT}
TARGETS ${executable}
RUNTIME DESTINATION bin)

swift_is_installing_component(${ADDSWIFTHOSTTOOL_SWIFT_COMPONENT}
is_installing)

if(NOT is_installing)
set_property(GLOBAL APPEND PROPERTY SWIFT_BUILDTREE_EXPORTS ${executable})
else()
set_property(GLOBAL APPEND PROPERTY SWIFT_EXPORTS ${executable})
endif()
swift_is_installing_component(${ADDSWIFTHOSTTOOL_SWIFT_COMPONENT}
is_installing)

if(NOT is_installing)
set_property(GLOBAL APPEND PROPERTY SWIFT_BUILDTREE_EXPORTS ${executable})
else()
set_property(GLOBAL APPEND PROPERTY SWIFT_EXPORTS ${executable})
endif()
endfunction()

Expand Down
8 changes: 2 additions & 6 deletions tools/swift-stdlib-tool/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
add_swift_host_tool(swift-stdlib-tool
swift-stdlib-tool.mm)
swift-stdlib-tool.mm
SWIFT_COMPONENT compiler)

find_library(FOUNDATION NAMES Foundation)
target_link_libraries(swift-stdlib-tool PRIVATE ${FOUNDATION})

swift_install_in_component(compiler
TARGETS swift-stdlib-tool
RUNTIME DESTINATION "bin")