Skip to content

Commit 8abd75c

Browse files
authored
Merge pull request #2637 from ahoppen/6.0/cherry-pick-2024-05-01
[6.0] Add option to install targets even when not top level
2 parents 9e802f9 + f8347f1 commit 8abd75c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

cmake/modules/AddSwiftHostLibrary.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ function(add_swift_syntax_library name)
130130
endif()
131131
endif()
132132

133-
if(PROJECT_IS_TOP_LEVEL)
133+
if(PROJECT_IS_TOP_LEVEL OR SWIFT_SYNTAX_INSTALL_TARGETS)
134134
# Install this target
135135
install(TARGETS ${name}
136136
EXPORT SwiftSyntaxTargets
@@ -148,4 +148,5 @@ function(add_swift_syntax_library name)
148148
else()
149149
set_property(GLOBAL APPEND PROPERTY SWIFT_EXPORTS ${name})
150150
endif()
151+
add_library(SwiftSyntax::${name} ALIAS ${name})
151152
endfunction()

cmake/modules/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
if(PROJECT_IS_TOP_LEVEL)
1+
if(PROJECT_IS_TOP_LEVEL OR SWIFT_SYNTAX_INSTALL_TARGETS)
22
export(EXPORT SwiftSyntaxTargets
33
FILE ${CMAKE_CURRENT_BINARY_DIR}/SwiftSyntaxConfig.cmake
44
NAMESPACE SwiftSyntax::)

0 commit comments

Comments
 (0)