Skip to content
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

build: parse arguments for add_swift_host_library #2704

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
12 changes: 9 additions & 3 deletions cmake/modules/AddSwiftHostLibrary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,18 @@ endfunction()

# Add a new host library with the given name.
function(add_swift_syntax_library name)
set(ASHL_SOURCES ${ARGN})
cmake_parse_arguments(ARGS "EXCLUDE_FROM_ALL" "" "" ${ARGN})

set(ASHL_SOURCES ${ARGS_UNPARSED_ARGUMENTS})

set(target ${SWIFTSYNTAX_TARGET_NAMESPACE}${name})

# Create the library target.
add_library(${target} ${ASHL_SOURCES})
if(ARGS_EXCLUDE_FROM_ALL)
add_library(${target} EXCLUDE_FROM_ALL ${ASHL_SOURCES})
else()
add_library(${target} ${ASHL_SOURCES})
endif()

if(NOT DEFINED SWIFTSYNTAX_EMIT_MODULE OR SWIFTSYNTAX_EMIT_MODULE)
# Determine where Swift modules will be built and installed.
Expand Down Expand Up @@ -150,7 +156,7 @@ function(add_swift_syntax_library name)
endif()
endif()

if(PROJECT_IS_TOP_LEVEL OR SWIFT_SYNTAX_INSTALL_TARGETS)
if(NOT ARGS_EXCLUDE_FROM_ALL AND (PROJECT_IS_TOP_LEVEL OR SWIFT_SYNTAX_INSTALL_TARGETS))
# Install this target
install(TARGETS ${target}
EXPORT SwiftSyntaxTargets
Expand Down