Merge topic 'clarify-add_dependencies-error'
de13d68
add_dependencies: Distinguish target v. file dependencies in error (#14050)
This commit is contained in:
commit
ec0b84576b
|
@ -35,10 +35,14 @@ bool cmAddDependenciesCommand
|
|||
}
|
||||
else
|
||||
{
|
||||
std::string error = "Adding dependency to non-existent target: ";
|
||||
error += target_name;
|
||||
this->SetError(error.c_str());
|
||||
return false;
|
||||
cmOStringStream e;
|
||||
e << "Cannot add target-level dependencies to non-existent target \""
|
||||
<< target_name << "\".\n"
|
||||
<< "The add_dependencies works for top-level logical targets created "
|
||||
<< "by the add_executable, add_library, or add_custom_target commands. "
|
||||
<< "If you want to add file-level dependencies see the DEPENDS option "
|
||||
<< "of the add_custom_target and add_custom_command commands.";
|
||||
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -68,6 +68,7 @@ if(NOT WIN32)
|
|||
endif()
|
||||
add_RunCMake_test(CompatibleInterface)
|
||||
|
||||
add_RunCMake_test(add_dependencies)
|
||||
add_RunCMake_test(build_command)
|
||||
add_RunCMake_test(find_package)
|
||||
add_RunCMake_test(include)
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
cmake_minimum_required(VERSION 2.8)
|
||||
project(${RunCMake_TEST} NONE)
|
||||
include(${RunCMake_TEST}.cmake)
|
|
@ -0,0 +1 @@
|
|||
1
|
|
@ -0,0 +1,9 @@
|
|||
CMake Error at NoTarget.cmake:1 \(add_dependencies\):
|
||||
Cannot add target-level dependencies to non-existent target "foo".
|
||||
|
||||
The add_dependencies works for top-level logical targets created by the
|
||||
add_executable, add_library, or add_custom_target commands. If you want to
|
||||
add file-level dependencies see the DEPENDS option of the add_custom_target
|
||||
and add_custom_command commands.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
|
@ -0,0 +1 @@
|
|||
add_dependencies(foo bar)
|
|
@ -0,0 +1,3 @@
|
|||
include(RunCMake)
|
||||
|
||||
run_cmake(NoTarget)
|
Loading…
Reference in New Issue