Skip to content

Commit 72179fa

Browse files
committed
Add option to install targets even when not top level
Also add namespaced targets for any exported target to facilitate find_package and FetchContent both using the same target names.
1 parent ae08a1c commit 72179fa

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cmake/modules/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
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::)
55
endif()
6+
7+
foreach(OrigTarget ${SwiftSyntaxTargets})
8+
add_library(SwiftSyntax::${OrigTarget} ALIAS ${OrigTarget})
9+
endforeach()

0 commit comments

Comments
 (0)