diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-07-12 09:14:31 +0200 |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-08-02 15:21:00 +0200 |
commit | 370bf554151a1b272baf62a0ce9823cf9995116e (patch) | |
tree | 8f0a75a9894691c2b56588c3be4b090bf07a1558 /Tests/RunCMake | |
parent | b341bf2178e3923636735ae1df53a33e5857df7d (diff) | |
download | cmake-370bf554151a1b272baf62a0ce9823cf9995116e.tar.gz |
Add the ALIAS target concept for libraries and executables.
* The ALIAS name must match a validity regex.
* Executables and libraries may be aliased.
* An ALIAS acts immutable. It can not be used as the lhs
of target_link_libraries or other commands.
* An ALIAS can be used with add_custom_command, add_custom_target,
and add_test in the same way regular targets can.
* The target of an ALIAS can be retrieved with the ALIASED_TARGET
target property.
* An ALIAS does not appear in the generated buildsystem. It
is kept separate from cmMakefile::Targets for that reason.
* A target may have multiple aliases.
* An ALIAS target may not itself have an alias.
* An IMPORTED target may not have an alias.
* An ALIAS may not be exported or imported.
Diffstat (limited to 'Tests/RunCMake')
58 files changed, 248 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 6d1bca2b69..1b9c17bd7c 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -98,6 +98,7 @@ add_RunCMake_test(try_compile) add_RunCMake_test(variable_watch) add_RunCMake_test(CMP0004) add_RunCMake_test(TargetPolicies) +add_RunCMake_test(alias_targets) find_package(Qt4 QUIET) find_package(Qt5Core QUIET) diff --git a/Tests/RunCMake/alias_targets/CMakeLists.txt b/Tests/RunCMake/alias_targets/CMakeLists.txt new file mode 100644 index 0000000000..e8db6b05be --- /dev/null +++ b/Tests/RunCMake/alias_targets/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/alias_targets/RunCMakeTest.cmake b/Tests/RunCMake/alias_targets/RunCMakeTest.cmake new file mode 100644 index 0000000000..9a5eaaf1c5 --- /dev/null +++ b/Tests/RunCMake/alias_targets/RunCMakeTest.cmake @@ -0,0 +1,20 @@ +include(RunCMake) + +run_cmake(no-targets) +run_cmake(multiple-targets) +run_cmake(exclude-from-all) +run_cmake(imported) +run_cmake(invalid-name) +run_cmake(invalid-target) +run_cmake(imported-target) +run_cmake(alias-target) +run_cmake(set_property) +run_cmake(set_target_properties) +run_cmake(target_link_libraries) +run_cmake(target_include_directories) +run_cmake(export) +run_cmake(install-export) +run_cmake(name-conflict) +run_cmake(add_dependencies) +run_cmake(add_executable-library) +run_cmake(add_library-executable) diff --git a/Tests/RunCMake/alias_targets/add_dependencies-result.txt b/Tests/RunCMake/alias_targets/add_dependencies-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/alias_targets/add_dependencies-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/alias_targets/add_dependencies-stderr.txt b/Tests/RunCMake/alias_targets/add_dependencies-stderr.txt new file mode 100644 index 0000000000..53f248741f --- /dev/null +++ b/Tests/RunCMake/alias_targets/add_dependencies-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at add_dependencies.cmake:9 \(add_dependencies\): + Cannot add target-level dependencies to alias target "alias". + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/alias_targets/add_dependencies.cmake b/Tests/RunCMake/alias_targets/add_dependencies.cmake new file mode 100644 index 0000000000..7436371a22 --- /dev/null +++ b/Tests/RunCMake/alias_targets/add_dependencies.cmake @@ -0,0 +1,9 @@ + +enable_language(CXX) + +add_library(foo empty.cpp) +add_library(bar empty.cpp) + +add_library(alias ALIAS foo) + +add_dependencies(alias bar) diff --git a/Tests/RunCMake/alias_targets/add_executable-library-result.txt b/Tests/RunCMake/alias_targets/add_executable-library-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/alias_targets/add_executable-library-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/alias_targets/add_executable-library-stderr.txt b/Tests/RunCMake/alias_targets/add_executable-library-stderr.txt new file mode 100644 index 0000000000..eb22b3dbec --- /dev/null +++ b/Tests/RunCMake/alias_targets/add_executable-library-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at add_executable-library.cmake:6 \(add_executable\): + add_executable cannot create ALIAS target "alias" because target "foo" is + not an executable. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/alias_targets/add_executable-library.cmake b/Tests/RunCMake/alias_targets/add_executable-library.cmake new file mode 100644 index 0000000000..e30f112d84 --- /dev/null +++ b/Tests/RunCMake/alias_targets/add_executable-library.cmake @@ -0,0 +1,6 @@ + +enable_language(CXX) + +add_library(foo empty.cpp) + +add_executable(alias ALIAS foo) diff --git a/Tests/RunCMake/alias_targets/add_library-executable-result.txt b/Tests/RunCMake/alias_targets/add_library-executable-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/alias_targets/add_library-executable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/alias_targets/add_library-executable-stderr.txt b/Tests/RunCMake/alias_targets/add_library-executable-stderr.txt new file mode 100644 index 0000000000..ee290e4411 --- /dev/null +++ b/Tests/RunCMake/alias_targets/add_library-executable-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at add_library-executable.cmake:6 \(add_library\): + add_library cannot create ALIAS target "alias" because target "foo" is not + a library. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/alias_targets/add_library-executable.cmake b/Tests/RunCMake/alias_targets/add_library-executable.cmake new file mode 100644 index 0000000000..22457a9b73 --- /dev/null +++ b/Tests/RunCMake/alias_targets/add_library-executable.cmake @@ -0,0 +1,6 @@ + +enable_language(CXX) + +add_executable(foo empty.cpp) + +add_library(alias ALIAS foo) diff --git a/Tests/RunCMake/alias_targets/alias-target-result.txt b/Tests/RunCMake/alias_targets/alias-target-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/alias_targets/alias-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/alias_targets/alias-target-stderr.txt b/Tests/RunCMake/alias_targets/alias-target-stderr.txt new file mode 100644 index 0000000000..eae227a256 --- /dev/null +++ b/Tests/RunCMake/alias_targets/alias-target-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at alias-target.cmake:8 \(add_library\): + add_library cannot create ALIAS target "next_alias" because target "alias" + is itself an ALIAS. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/alias_targets/alias-target.cmake b/Tests/RunCMake/alias_targets/alias-target.cmake new file mode 100644 index 0000000000..0b8da6014b --- /dev/null +++ b/Tests/RunCMake/alias_targets/alias-target.cmake @@ -0,0 +1,8 @@ + +enable_language(CXX) + +add_library(foo empty.cpp) + +add_library(alias ALIAS foo) + +add_library(next_alias ALIAS alias) diff --git a/Tests/RunCMake/alias_targets/empty.cpp b/Tests/RunCMake/alias_targets/empty.cpp new file mode 100644 index 0000000000..bfbbddeb90 --- /dev/null +++ b/Tests/RunCMake/alias_targets/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/alias_targets/exclude-from-all-result.txt b/Tests/RunCMake/alias_targets/exclude-from-all-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/alias_targets/exclude-from-all-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/alias_targets/exclude-from-all-stderr.txt b/Tests/RunCMake/alias_targets/exclude-from-all-stderr.txt new file mode 100644 index 0000000000..fce15d3847 --- /dev/null +++ b/Tests/RunCMake/alias_targets/exclude-from-all-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at exclude-from-all.cmake:6 \(add_library\): + add_library EXCLUDE_FROM_ALL with ALIAS makes no sense. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/alias_targets/exclude-from-all.cmake b/Tests/RunCMake/alias_targets/exclude-from-all.cmake new file mode 100644 index 0000000000..0091918fe3 --- /dev/null +++ b/Tests/RunCMake/alias_targets/exclude-from-all.cmake @@ -0,0 +1,6 @@ + +enable_language(CXX) + +add_library(foo empty.cpp) + +add_library(alias ALIAS EXCLUDE_FROM_ALL foo) diff --git a/Tests/RunCMake/alias_targets/export-result.txt b/Tests/RunCMake/alias_targets/export-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/alias_targets/export-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/alias_targets/export-stderr.txt b/Tests/RunCMake/alias_targets/export-stderr.txt new file mode 100644 index 0000000000..848b9840c7 --- /dev/null +++ b/Tests/RunCMake/alias_targets/export-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at export.cmake:8 \(export\): + export given ALIAS target "alias" which may not be exported. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/alias_targets/export.cmake b/Tests/RunCMake/alias_targets/export.cmake new file mode 100644 index 0000000000..dd84a80da2 --- /dev/null +++ b/Tests/RunCMake/alias_targets/export.cmake @@ -0,0 +1,8 @@ + +enable_language(CXX) + +add_library(foo empty.cpp) + +add_library(alias ALIAS foo) + +export(TARGETS alias FILE someFile.cmake) diff --git a/Tests/RunCMake/alias_targets/imported-result.txt b/Tests/RunCMake/alias_targets/imported-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/alias_targets/imported-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/alias_targets/imported-stderr.txt b/Tests/RunCMake/alias_targets/imported-stderr.txt new file mode 100644 index 0000000000..b905847f25 --- /dev/null +++ b/Tests/RunCMake/alias_targets/imported-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at imported.cmake:2 \(add_library\): + add_library IMPORTED with ALIAS is not allowed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/alias_targets/imported-target-result.txt b/Tests/RunCMake/alias_targets/imported-target-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/alias_targets/imported-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/alias_targets/imported-target-stderr.txt b/Tests/RunCMake/alias_targets/imported-target-stderr.txt new file mode 100644 index 0000000000..bbff29a804 --- /dev/null +++ b/Tests/RunCMake/alias_targets/imported-target-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at imported-target.cmake:6 \(add_library\): + add_library cannot create ALIAS target "alias" because target "foo" is + IMPORTED. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/alias_targets/imported-target.cmake b/Tests/RunCMake/alias_targets/imported-target.cmake new file mode 100644 index 0000000000..7259ab0912 --- /dev/null +++ b/Tests/RunCMake/alias_targets/imported-target.cmake @@ -0,0 +1,6 @@ + +enable_language(CXX) + +add_library(foo SHARED IMPORTED) + +add_library(alias ALIAS foo) diff --git a/Tests/RunCMake/alias_targets/imported.cmake b/Tests/RunCMake/alias_targets/imported.cmake new file mode 100644 index 0000000000..6a605911a7 --- /dev/null +++ b/Tests/RunCMake/alias_targets/imported.cmake @@ -0,0 +1,2 @@ + +add_library(alias IMPORTED ALIAS) diff --git a/Tests/RunCMake/alias_targets/install-export-result.txt b/Tests/RunCMake/alias_targets/install-export-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/alias_targets/install-export-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/alias_targets/install-export-stderr.txt b/Tests/RunCMake/alias_targets/install-export-stderr.txt new file mode 100644 index 0000000000..3c3c0edd63 --- /dev/null +++ b/Tests/RunCMake/alias_targets/install-export-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at install-export.cmake:8 \(install\): + install TARGETS given target "alias" which is an alias. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/alias_targets/install-export.cmake b/Tests/RunCMake/alias_targets/install-export.cmake new file mode 100644 index 0000000000..b1c6a4f4d4 --- /dev/null +++ b/Tests/RunCMake/alias_targets/install-export.cmake @@ -0,0 +1,9 @@ + +enable_language(CXX) + +add_library(foo empty.cpp) + +add_library(alias ALIAS foo) + +install(TARGETS alias EXPORT theTargets DESTINATION prefix) +install(EXPORT theTargets DESTINATION lib/cmake) diff --git a/Tests/RunCMake/alias_targets/invalid-name-result.txt b/Tests/RunCMake/alias_targets/invalid-name-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/alias_targets/invalid-name-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/alias_targets/invalid-name-stderr.txt b/Tests/RunCMake/alias_targets/invalid-name-stderr.txt new file mode 100644 index 0000000000..d33b57c105 --- /dev/null +++ b/Tests/RunCMake/alias_targets/invalid-name-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at invalid-name.cmake:6 \(add_library\): + add_library Invalid name for ALIAS: invalid\$name +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/alias_targets/invalid-name.cmake b/Tests/RunCMake/alias_targets/invalid-name.cmake new file mode 100644 index 0000000000..bbd39e3b6f --- /dev/null +++ b/Tests/RunCMake/alias_targets/invalid-name.cmake @@ -0,0 +1,6 @@ + +enable_language(CXX) + +add_library(foo empty.cpp) + +add_library(invalid$name ALIAS foo) diff --git a/Tests/RunCMake/alias_targets/invalid-target-result.txt b/Tests/RunCMake/alias_targets/invalid-target-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/alias_targets/invalid-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/alias_targets/invalid-target-stderr.txt b/Tests/RunCMake/alias_targets/invalid-target-stderr.txt new file mode 100644 index 0000000000..342d488b90 --- /dev/null +++ b/Tests/RunCMake/alias_targets/invalid-target-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at invalid-target.cmake:2 \(add_library\): + add_library cannot create ALIAS target "alias" because target "foo" does + not already exist. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/alias_targets/invalid-target.cmake b/Tests/RunCMake/alias_targets/invalid-target.cmake new file mode 100644 index 0000000000..c43da61623 --- /dev/null +++ b/Tests/RunCMake/alias_targets/invalid-target.cmake @@ -0,0 +1,2 @@ + +add_library(alias ALIAS foo) diff --git a/Tests/RunCMake/alias_targets/multiple-targets-result.txt b/Tests/RunCMake/alias_targets/multiple-targets-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/alias_targets/multiple-targets-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/alias_targets/multiple-targets-stderr.txt b/Tests/RunCMake/alias_targets/multiple-targets-stderr.txt new file mode 100644 index 0000000000..596f404e40 --- /dev/null +++ b/Tests/RunCMake/alias_targets/multiple-targets-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at multiple-targets.cmake:7 \(add_library\): + add_library ALIAS requires exactly one target argument. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/alias_targets/multiple-targets.cmake b/Tests/RunCMake/alias_targets/multiple-targets.cmake new file mode 100644 index 0000000000..811eb7a534 --- /dev/null +++ b/Tests/RunCMake/alias_targets/multiple-targets.cmake @@ -0,0 +1,7 @@ + +enable_language(CXX) + +add_library(foo empty.cpp) +add_library(bar empty.cpp) + +add_library(alias ALIAS foo bar) diff --git a/Tests/RunCMake/alias_targets/name-conflict-result.txt b/Tests/RunCMake/alias_targets/name-conflict-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/alias_targets/name-conflict-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/alias_targets/name-conflict-stderr.txt b/Tests/RunCMake/alias_targets/name-conflict-stderr.txt new file mode 100644 index 0000000000..3c0faa9df8 --- /dev/null +++ b/Tests/RunCMake/alias_targets/name-conflict-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at name-conflict.cmake:8 \(add_library\): + add_library cannot create target "bar" because an alias with the same name + already exists. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/alias_targets/name-conflict.cmake b/Tests/RunCMake/alias_targets/name-conflict.cmake new file mode 100644 index 0000000000..d21a092489 --- /dev/null +++ b/Tests/RunCMake/alias_targets/name-conflict.cmake @@ -0,0 +1,8 @@ + +enable_language(CXX) + +add_library(foo empty.cpp) + +add_library(bar ALIAS foo) + +add_library(bar empty.cpp) diff --git a/Tests/RunCMake/alias_targets/no-targets-result.txt b/Tests/RunCMake/alias_targets/no-targets-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/alias_targets/no-targets-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/alias_targets/no-targets-stderr.txt b/Tests/RunCMake/alias_targets/no-targets-stderr.txt new file mode 100644 index 0000000000..cdf7e577c1 --- /dev/null +++ b/Tests/RunCMake/alias_targets/no-targets-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at no-targets.cmake:4 \(add_library\): + add_library ALIAS requires exactly one target argument. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/alias_targets/no-targets.cmake b/Tests/RunCMake/alias_targets/no-targets.cmake new file mode 100644 index 0000000000..a5c5ee501d --- /dev/null +++ b/Tests/RunCMake/alias_targets/no-targets.cmake @@ -0,0 +1,4 @@ + +enable_language(CXX) + +add_library(alias ALIAS) diff --git a/Tests/RunCMake/alias_targets/set_property-result.txt b/Tests/RunCMake/alias_targets/set_property-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/alias_targets/set_property-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/alias_targets/set_property-stderr.txt b/Tests/RunCMake/alias_targets/set_property-stderr.txt new file mode 100644 index 0000000000..e85aa568ce --- /dev/null +++ b/Tests/RunCMake/alias_targets/set_property-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at set_property.cmake:8 \(set_property\): + set_property can not be used on an ALIAS target. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/alias_targets/set_property.cmake b/Tests/RunCMake/alias_targets/set_property.cmake new file mode 100644 index 0000000000..1f5e475c4a --- /dev/null +++ b/Tests/RunCMake/alias_targets/set_property.cmake @@ -0,0 +1,8 @@ + +enable_language(CXX) + +add_library(foo empty.cpp) + +add_library(alias ALIAS foo) + +set_property(TARGET alias PROPERTY ANYTHING 1) diff --git a/Tests/RunCMake/alias_targets/set_target_properties-result.txt b/Tests/RunCMake/alias_targets/set_target_properties-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/alias_targets/set_target_properties-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/alias_targets/set_target_properties-stderr.txt b/Tests/RunCMake/alias_targets/set_target_properties-stderr.txt new file mode 100644 index 0000000000..8922c0d3e2 --- /dev/null +++ b/Tests/RunCMake/alias_targets/set_target_properties-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at set_target_properties.cmake:8 \(set_target_properties\): + set_target_properties can not be used on an ALIAS target. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/alias_targets/set_target_properties.cmake b/Tests/RunCMake/alias_targets/set_target_properties.cmake new file mode 100644 index 0000000000..ee44d4595a --- /dev/null +++ b/Tests/RunCMake/alias_targets/set_target_properties.cmake @@ -0,0 +1,8 @@ + +enable_language(CXX) + +add_library(foo empty.cpp) + +add_library(alias ALIAS foo) + +set_target_properties(alias PROPERTIES ANYTHING 1) diff --git a/Tests/RunCMake/alias_targets/target_include_directories-result.txt b/Tests/RunCMake/alias_targets/target_include_directories-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/alias_targets/target_include_directories-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/alias_targets/target_include_directories-stderr.txt b/Tests/RunCMake/alias_targets/target_include_directories-stderr.txt new file mode 100644 index 0000000000..b8903b2454 --- /dev/null +++ b/Tests/RunCMake/alias_targets/target_include_directories-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at target_include_directories.cmake:8 \(target_include_directories\): + target_include_directories can not be used on an ALIAS target. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/alias_targets/target_include_directories.cmake b/Tests/RunCMake/alias_targets/target_include_directories.cmake new file mode 100644 index 0000000000..c26830e119 --- /dev/null +++ b/Tests/RunCMake/alias_targets/target_include_directories.cmake @@ -0,0 +1,8 @@ + +enable_language(CXX) + +add_library(foo empty.cpp) + +add_library(alias ALIAS foo) + +target_include_directories(alias PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>) diff --git a/Tests/RunCMake/alias_targets/target_link_libraries-result.txt b/Tests/RunCMake/alias_targets/target_link_libraries-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/alias_targets/target_link_libraries-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/alias_targets/target_link_libraries-stderr.txt b/Tests/RunCMake/alias_targets/target_link_libraries-stderr.txt new file mode 100644 index 0000000000..2d7ff20da4 --- /dev/null +++ b/Tests/RunCMake/alias_targets/target_link_libraries-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at target_link_libraries.cmake:9 \(target_link_libraries\): + target_link_libraries can not be used on an ALIAS target. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/alias_targets/target_link_libraries.cmake b/Tests/RunCMake/alias_targets/target_link_libraries.cmake new file mode 100644 index 0000000000..b7b9e60185 --- /dev/null +++ b/Tests/RunCMake/alias_targets/target_link_libraries.cmake @@ -0,0 +1,9 @@ + +enable_language(CXX) + +add_library(foo empty.cpp) +add_library(bar empty.cpp) + +add_library(alias ALIAS foo) + +target_link_libraries(alias bar) |