mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-13 12:59:55 -05:00
@@ -12,7 +12,6 @@ ensure that they build before ``<target>`` does. A top-level target
|
|||||||
is one created by one of the :command:`add_executable`,
|
is one created by one of the :command:`add_executable`,
|
||||||
:command:`add_library`, or :command:`add_custom_target` commands
|
:command:`add_library`, or :command:`add_custom_target` commands
|
||||||
(but not targets generated by CMake like ``install``).
|
(but not targets generated by CMake like ``install``).
|
||||||
At least one ``<target-dependency>`` must be given.
|
|
||||||
|
|
||||||
Dependencies added to an :ref:`imported target <Imported Targets>`
|
Dependencies added to an :ref:`imported target <Imported Targets>`
|
||||||
or an :ref:`interface library <Interface Libraries>` are followed
|
or an :ref:`interface library <Interface Libraries>` are followed
|
||||||
@@ -32,6 +31,10 @@ transitively in its place since the target itself does not build.
|
|||||||
finished before sources in ``<target>`` start compiling; this
|
finished before sources in ``<target>`` start compiling; this
|
||||||
ensures generated sources are available.
|
ensures generated sources are available.
|
||||||
|
|
||||||
|
.. versionchanged:: 4.1
|
||||||
|
The command may be called with no dependencies.
|
||||||
|
Previously, at least one dependency was required.
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
|
|
||||||
|
|||||||
4
Help/release/dev/add-dependency-one-arg.rst
Normal file
4
Help/release/dev/add-dependency-one-arg.rst
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
add-dependency-one-arg
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
* The :command:`add_dependencies` command may be called with no dependencies.
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
bool cmAddDependenciesCommand(std::vector<std::string> const& args,
|
bool cmAddDependenciesCommand(std::vector<std::string> const& args,
|
||||||
cmExecutionStatus& status)
|
cmExecutionStatus& status)
|
||||||
{
|
{
|
||||||
if (args.size() < 2) {
|
if (args.empty()) {
|
||||||
status.SetError("called with incorrect number of arguments");
|
status.SetError("called with incorrect number of arguments");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
1
Tests/RunCMake/add_dependencies/NoArgs-result.txt
Normal file
1
Tests/RunCMake/add_dependencies/NoArgs-result.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
1
|
||||||
4
Tests/RunCMake/add_dependencies/NoArgs-stderr.txt
Normal file
4
Tests/RunCMake/add_dependencies/NoArgs-stderr.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
CMake Error at NoArgs.cmake:[0-9]+ \(add_dependencies\):
|
||||||
|
add_dependencies called with incorrect number of arguments
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMakeLists\.txt:[0-9]+ \(include\)
|
||||||
1
Tests/RunCMake/add_dependencies/NoArgs.cmake
Normal file
1
Tests/RunCMake/add_dependencies/NoArgs.cmake
Normal file
@@ -0,0 +1 @@
|
|||||||
|
add_dependencies()
|
||||||
3
Tests/RunCMake/add_dependencies/NoDependencies.cmake
Normal file
3
Tests/RunCMake/add_dependencies/NoDependencies.cmake
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
enable_language(C)
|
||||||
|
add_library(a a.c)
|
||||||
|
add_dependencies(a ${noDependencies})
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
include(RunCMake)
|
include(RunCMake)
|
||||||
|
|
||||||
|
run_cmake(NoArgs)
|
||||||
run_cmake(NoTarget)
|
run_cmake(NoTarget)
|
||||||
|
run_cmake(NoDependencies)
|
||||||
run_cmake(ReadOnlyProperty)
|
run_cmake(ReadOnlyProperty)
|
||||||
run_cmake(RetrieveDependencies)
|
run_cmake(RetrieveDependencies)
|
||||||
|
|||||||
Reference in New Issue
Block a user