Skip to content

Commit a40e419

Browse files
committed
[cmake] Merge swift_configure_install_components into swift_configure_components.
1 parent 864174c commit a40e419

File tree

2 files changed

+20
-24
lines changed

2 files changed

+20
-24
lines changed

CMakeLists.txt

+3-5
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,6 @@ set(SWIFT_ENABLE_LLD_LINKER FALSE CACHE BOOL
126126
set(SWIFT_ENABLE_GOLD_LINKER FALSE CACHE BOOL
127127
"Enable using the gold linker when available")
128128

129-
# Configure and initialize swift components.
130-
include(SwiftComponents)
131-
swift_configure_components()
132-
133129
set(SWIFT_SDKS "" CACHE STRING
134130
"If non-empty, limits building target binaries only to specified SDKs (despite other SDKs being available)")
135131

@@ -331,6 +327,7 @@ set(CMAKE_CXX_ARCHIVE_FINISH "")
331327

332328
include(CheckCXXSourceRuns)
333329
include(CMakeParseArguments)
330+
include(SwiftComponents)
334331
include(SwiftHandleGybSources)
335332
include(SwiftSetIfArchBitness)
336333
include(SwiftSource)
@@ -339,7 +336,8 @@ include(SwiftConfigureSDK)
339336
include(SwiftComponents)
340337
include(SwiftList)
341338

342-
swift_configure_install_components("${SWIFT_INSTALL_COMPONENTS}")
339+
# Configure swift include, install, build components.
340+
swift_configure_components()
343341

344342
if("${CMAKE_VERSION}" VERSION_LESS "3.0")
345343
set(SWIFT_CMAKE_HAS_GENERATOR_EXPRESSIONS FALSE)

cmake/modules/SwiftComponents.cmake

+17-19
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,23 @@ macro(swift_configure_components)
7171
# Set the SWIFT_INSTALL_COMPONENTS variable to the default value if it is not passed in via -D
7272
set(SWIFT_INSTALL_COMPONENTS "${_SWIFT_DEFINED_COMPONENTS}" CACHE STRING
7373
"A semicolon-separated list of components to install ${_SWIFT_DEFINED_COMPONENTS}")
74+
75+
foreach(component ${_SWIFT_DEFINED_COMPONENTS})
76+
string(TOUPPER "${component}" var_name_piece)
77+
string(REPLACE "-" "_" var_name_piece "${var_name_piece}")
78+
set(SWIFT_INSTALL_${var_name_piece} FALSE)
79+
endforeach()
80+
81+
foreach(component ${SWIFT_INSTALL_COMPONENTS})
82+
list(FIND _SWIFT_DEFINED_COMPONENTS "${component}" index)
83+
if(${index} EQUAL -1)
84+
message(FATAL_ERROR "unknown install component: ${component}")
85+
endif()
86+
87+
string(TOUPPER "${component}" var_name_piece)
88+
string(REPLACE "-" "_" var_name_piece "${var_name_piece}")
89+
set(SWIFT_INSTALL_${var_name_piece} TRUE)
90+
endforeach()
7491
endmacro()
7592

7693
function(swift_is_installing_component component result_var_name)
@@ -105,22 +122,3 @@ function(swift_install_in_component component)
105122
install(${ARGN})
106123
endif()
107124
endfunction()
108-
109-
macro(swift_configure_install_components install_components)
110-
foreach(component ${_SWIFT_DEFINED_COMPONENTS})
111-
string(TOUPPER "${component}" var_name_piece)
112-
string(REPLACE "-" "_" var_name_piece "${var_name_piece}")
113-
set(SWIFT_INSTALL_${var_name_piece} FALSE)
114-
endforeach()
115-
116-
foreach(component ${install_components})
117-
list(FIND _SWIFT_DEFINED_COMPONENTS "${component}" index)
118-
if(${index} EQUAL -1)
119-
message(FATAL_ERROR "unknown install component: ${component}")
120-
endif()
121-
122-
string(TOUPPER "${component}" var_name_piece)
123-
string(REPLACE "-" "_" var_name_piece "${var_name_piece}")
124-
set(SWIFT_INSTALL_${var_name_piece} TRUE)
125-
endforeach()
126-
endmacro()

0 commit comments

Comments
 (0)