diff options
author | Raul Tambre <raul@tambre.ee> | 2020-08-08 10:17:05 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-08-21 12:38:39 (GMT) |
commit | 359c500a2466ffc2507b81c0089bce18fd5debbb (patch) | |
tree | e8eba9aa91e55b068a9b92989813a3db131befd5 /Tests/RunCMake/target_link_libraries | |
parent | 692bc2de9475d14a2f40b94d88ea91db2df5311c (diff) | |
download | CMake-359c500a2466ffc2507b81c0089bce18fd5debbb.zip CMake-359c500a2466ffc2507b81c0089bce18fd5debbb.tar.gz CMake-359c500a2466ffc2507b81c0089bce18fd5debbb.tar.bz2 |
cmTarget: Raise error if imported target location is not set
Previously we would synthesize <TARGET_NAME>-NOTFOUND as the location. This
would then end up on the link line and cause build failures.
Policy CMP0110 is added to control this behaviour.
Fixes #19080, #19943.
Diffstat (limited to 'Tests/RunCMake/target_link_libraries')
-rw-r--r-- | Tests/RunCMake/target_link_libraries/SharedDepNotTarget.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/target_link_libraries/UNKNOWN-IMPORTED-GLOBAL.cmake | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/Tests/RunCMake/target_link_libraries/SharedDepNotTarget.cmake b/Tests/RunCMake/target_link_libraries/SharedDepNotTarget.cmake index bab537e..d6ddfae 100644 --- a/Tests/RunCMake/target_link_libraries/SharedDepNotTarget.cmake +++ b/Tests/RunCMake/target_link_libraries/SharedDepNotTarget.cmake @@ -3,7 +3,8 @@ set(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") add_library(imported SHARED IMPORTED) set_target_properties(imported PROPERTIES - IMPORTED_LOCATION "imported" + IMPORTED_LOCATION "imported${CMAKE_SHARED_LIBRARY_SUFFIX}" + IMPORTED_IMPLIB "imported${CMAKE_IMPORT_LIBRARY_SUFFIX}" IMPORTED_LINK_DEPENDENT_LIBRARIES "/path/to/libSharedDep.so" ) add_executable(empty empty.c) diff --git a/Tests/RunCMake/target_link_libraries/UNKNOWN-IMPORTED-GLOBAL.cmake b/Tests/RunCMake/target_link_libraries/UNKNOWN-IMPORTED-GLOBAL.cmake index f52fa30..608f47b 100644 --- a/Tests/RunCMake/target_link_libraries/UNKNOWN-IMPORTED-GLOBAL.cmake +++ b/Tests/RunCMake/target_link_libraries/UNKNOWN-IMPORTED-GLOBAL.cmake @@ -1,4 +1,5 @@ enable_language(C) add_library(UnknownImportedGlobal UNKNOWN IMPORTED GLOBAL) +set_target_properties(UnknownImportedGlobal PROPERTIES IMPORTED_LOCATION "unknown.${CMAKE_SHARED_LIBRARY_SUFFIX}") add_library(mylib empty.c) target_link_libraries(mylib UnknownImportedGlobal) |