Skip to content

Commit 056d498

Browse files
authored
Merge pull request #7486 from hughbe/precondition-addswift-cleanup
Cleanup CMake _require_empty list
2 parents 713e5a2 + bc432e6 commit 056d498

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@ function(add_dependencies_multiple_targets)
2727
endif()
2828
endfunction()
2929

30-
function(_require_empty_list the_list the_message)
31-
if(the_list)
32-
message(FATAL_ERROR "${the_message}")
33-
endif()
34-
endfunction()
35-
3630
# Compute the library subdirectory to use for the given sdk and
3731
# architecture, placing the result in 'result_var_name'.
3832
function(compute_library_subdir result_var_name sdk arch)
@@ -976,7 +970,7 @@ function(_add_swift_library_single target name)
976970
if("${libkind}" STREQUAL "SHARED")
977971
target_link_libraries("${target}" PRIVATE ${SWIFTLIB_SINGLE_LINK_LIBRARIES})
978972
elseif("${libkind}" STREQUAL "OBJECT")
979-
_require_empty_list(
973+
precondition_list_empty(
980974
"${SWIFTLIB_SINGLE_LINK_LIBRARIES}"
981975
"OBJECT_LIBRARY may not link to anything")
982976
else()
@@ -1153,15 +1147,15 @@ function(_add_swift_library_single target name)
11531147
endif()
11541148

11551149
if("${libkind}" STREQUAL "OBJECT")
1156-
_require_empty_list(
1150+
precondition_list_empty(
11571151
"${SWIFTLIB_SINGLE_PRIVATE_LINK_LIBRARIES}"
11581152
"OBJECT_LIBRARY may not link to anything")
11591153
else()
11601154
target_link_libraries("${target}" PRIVATE
11611155
${SWIFTLIB_SINGLE_PRIVATE_LINK_LIBRARIES})
11621156
endif()
11631157
if("${libkind}" STREQUAL "OBJECT")
1164-
_require_empty_list(
1158+
precondition_list_empty(
11651159
"${SWIFTLIB_SINGLE_INTERFACE_LINK_LIBRARIES}"
11661160
"OBJECT_LIBRARY may not link to anything")
11671161
else()

cmake/modules/SwiftList.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,7 @@ function(precondition_list_is_disjoint first)
9191
list_union(RESULT "${${l}}" "${RESULT}")
9292
endforeach()
9393
endfunction()
94+
95+
function(precondition_list_empty l message)
96+
precondition(l NEGATE MESSAGE "${message}")
97+
endfunction()

0 commit comments

Comments
 (0)