mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
The add_dependencies command currently accepts ALIAS targets for <target-dependencies> which resolve to the referenced target. This further relaxes the command to accept an ALIAS <target> where the command will add the dependencies to the target which the alias references.
15 lines
359 B
CMake
15 lines
359 B
CMake
|
|
enable_language(CXX)
|
|
|
|
add_library(foo empty.cpp)
|
|
add_library(bar empty.cpp)
|
|
|
|
add_library(alias ALIAS foo)
|
|
|
|
add_dependencies(alias bar)
|
|
|
|
get_property(DEPS TARGET foo PROPERTY MANUALLY_ADDED_DEPENDENCIES)
|
|
if(NOT DEPS STREQUAL "bar")
|
|
message(SEND_ERROR "add_dependencies(): Expected 'bar' as dependency of 'foo' but got: '${DEPS}' instead of 'bar'.")
|
|
endif()
|