diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2020-05-30 09:45:53 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2020-05-30 09:47:39 (GMT) |
commit | 9436ad35df17df89e1a74f91103b04baad085127 (patch) | |
tree | 03dd545967151a213153304db2bafcdb3ce3987c /Tests/RunCMake | |
parent | 67dd68765700bbd6a981700c04f45b28cdc85587 (diff) | |
download | CMake-9436ad35df17df89e1a74f91103b04baad085127.zip CMake-9436ad35df17df89e1a74f91103b04baad085127.tar.gz CMake-9436ad35df17df89e1a74f91103b04baad085127.tar.bz2 |
target_link_libraries: self-link through ALIAS is an error
Fixes: #19617
Diffstat (limited to 'Tests/RunCMake')
7 files changed, 26 insertions, 0 deletions
diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt index 2d270c5..2454f25 100644 --- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt +++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt @@ -31,6 +31,7 @@ \* CMP0099 \* CMP0104 \* CMP0105 + \* CMP0108 Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link-result.txt b/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link-stderr.txt new file mode 100644 index 0000000..7389eff --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at CMP0108-self-link.cmake:[0-9]+ \(add_library\): + Target "foo" links to itself. +Call Stack \(most recent call first\): + CMP0108-NEW-self-link.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link.cmake b/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link.cmake new file mode 100644 index 0000000..4ee9621 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link.cmake @@ -0,0 +1,4 @@ + +cmake_policy (SET CMP0108 NEW) + +include (CMP0108-self-link.cmake) diff --git a/Tests/RunCMake/target_link_libraries/CMP0108-OLD-self-link.cmake b/Tests/RunCMake/target_link_libraries/CMP0108-OLD-self-link.cmake new file mode 100644 index 0000000..813104a --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0108-OLD-self-link.cmake @@ -0,0 +1,4 @@ + +cmake_policy (SET CMP0108 OLD) + +include (CMP0108-self-link.cmake) diff --git a/Tests/RunCMake/target_link_libraries/CMP0108-self-link.cmake b/Tests/RunCMake/target_link_libraries/CMP0108-self-link.cmake new file mode 100644 index 0000000..07a3490 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0108-self-link.cmake @@ -0,0 +1,9 @@ + +cmake_policy (SET CMP0038 NEW) +cmake_policy (SET CMP0042 NEW) + +enable_language(C) + +add_library(foo SHARED lib.c) +add_library(Bar::foo ALIAS foo) +target_link_libraries(foo PRIVATE Bar::foo) diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake index fb223ab..dfa71dd 100644 --- a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake @@ -19,6 +19,8 @@ run_cmake(CMP0079-link-WARN) run_cmake(CMP0079-link-OLD) run_cmake(CMP0079-link-NEW) run_cmake(CMP0079-link-NEW-bogus) +run_cmake(CMP0108-OLD-self-link) +run_cmake(CMP0108-NEW-self-link) run_cmake(ImportedTarget) run_cmake(ImportedTargetFailure) run_cmake(MixedSignature) |