Skip to content

Commit ee5ab9e

Browse files
committed
build: prevent accidental addition of LINK_LIBRARIES
Protect against LINK_LIBRARIES, directing the developer to target_link_libraries. This has no impact on the build currently.
1 parent 52ddabe commit ee5ab9e

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,7 +1354,6 @@ endfunction()
13541354
# [SHARED]
13551355
# [STATIC]
13561356
# [DEPENDS dep1 ...]
1357-
# [LINK_LIBRARIES dep1 ...]
13581357
# [INTERFACE_LINK_LIBRARIES dep1 ...]
13591358
# [SWIFT_MODULE_DEPENDS dep1 ...]
13601359
# [LLVM_COMPONENT_DEPENDS comp1 ...]
@@ -1377,9 +1376,6 @@ endfunction()
13771376
# DEPENDS
13781377
# Targets that this library depends on.
13791378
#
1380-
# LINK_LIBRARIES
1381-
# Libraries this library depends on.
1382-
#
13831379
# LLVM_COMPONENT_DEPENDS
13841380
# LLVM components this library depends on.
13851381
#
@@ -1419,6 +1415,10 @@ function(add_swift_host_library name)
14191415
${ARGN})
14201416
set(ASHL_SOURCES ${ASHL_UNPARSED_ARGUMENTS})
14211417

1418+
if(ASHL_LINK_LIBRARIES)
1419+
message(SEND_ERROR "library ${name} is using LINK_LIBRARIES parameter which is deprecated. Please use target_link_libraries instead")
1420+
endif()
1421+
14221422
translate_flags(ASHL "${options}")
14231423

14241424
if(NOT ASHL_SHARED AND NOT ASHL_STATIC)
@@ -1435,7 +1435,6 @@ function(add_swift_host_library name)
14351435
SDK ${SWIFT_HOST_VARIANT_SDK}
14361436
ARCHITECTURE ${SWIFT_HOST_VARIANT_ARCH}
14371437
DEPENDS ${ASHL_DEPENDS}
1438-
LINK_LIBRARIES ${ASHL_LINK_LIBRARIES}
14391438
LLVM_COMPONENT_DEPENDS ${ASHL_LLVM_COMPONENT_DEPENDS}
14401439
FILE_DEPENDS ${ASHL_FILE_DEPENDS}
14411440
C_COMPILE_FLAGS ${ASHL_C_COMPILE_FLAGS}
@@ -2249,14 +2248,18 @@ endmacro()
22492248
function(add_swift_host_tool executable)
22502249
set(options)
22512250
set(single_parameter_options SWIFT_COMPONENT)
2252-
set(multiple_parameter_options)
2251+
set(multiple_parameter_options LINK_LIBRARIES)
22532252

22542253
cmake_parse_arguments(ASHT
22552254
"${options}"
22562255
"${single_parameter_options}"
22572256
"${multiple_parameter_options}"
22582257
${ARGN})
22592258

2259+
if(ASHT_LINK_LIBRARIES)
2260+
message(SEND_ERROR "${executable} is using LINK_LIBRARIES parameter which is deprecated. Please use target_link_libraries instead")
2261+
endif()
2262+
22602263
precondition(ASHT_SWIFT_COMPONENT
22612264
MESSAGE "Swift Component is required to add a host tool")
22622265

0 commit comments

Comments
 (0)