Normalize OBJECT_DEPENDS paths to match custom commands (#15366)
Custom command path normalization added in commit v3.1.0-rc1~471^2 (add_custom_command: Normalize OUTPUT and DEPENDS paths, 2014-05-28) broke use of OBJECT_DEPENDS to bring in custom commands because the latter paths were not normalized too. Normalize them and add a test case. Reported-by: Daniel v. Gerpen
This commit is contained in:
parent
57622bd19d
commit
9259d77881
|
@ -676,6 +676,14 @@ void cmTargetTraceDependencies::Trace()
|
|||
{
|
||||
std::vector<std::string> objDeps;
|
||||
cmSystemTools::ExpandListArgument(additionalDeps, objDeps);
|
||||
for(std::vector<std::string>::iterator odi = objDeps.begin();
|
||||
odi != objDeps.end(); ++odi)
|
||||
{
|
||||
if (cmSystemTools::FileIsFullPath(*odi))
|
||||
{
|
||||
*odi = cmSystemTools::CollapseFullPath(*odi);
|
||||
}
|
||||
}
|
||||
this->FollowNames(objDeps);
|
||||
}
|
||||
|
||||
|
|
|
@ -600,6 +600,14 @@ cmNinjaTargetGenerator
|
|||
if(const char* objectDeps = source->GetProperty("OBJECT_DEPENDS")) {
|
||||
std::vector<std::string> depList;
|
||||
cmSystemTools::ExpandListArgument(objectDeps, depList);
|
||||
for(std::vector<std::string>::iterator odi = depList.begin();
|
||||
odi != depList.end(); ++odi)
|
||||
{
|
||||
if (cmSystemTools::FileIsFullPath(*odi))
|
||||
{
|
||||
*odi = cmSystemTools::CollapseFullPath(*odi);
|
||||
}
|
||||
}
|
||||
std::transform(depList.begin(), depList.end(),
|
||||
std::back_inserter(implicitDeps), MapToNinjaPath());
|
||||
}
|
||||
|
|
|
@ -153,6 +153,19 @@ add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/foo.c
|
|||
${PROJECT_BINARY_DIR}/foo.c
|
||||
)
|
||||
|
||||
# Test using OBJECT_DEPENDS to bring in a custom command.
|
||||
# Use a path that can be simplified to make sure paths
|
||||
# are consistently normalized.
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/subdir/../subdir/subdir.h
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/subdir.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/subdir/subdir.h
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/subdir.h.in
|
||||
)
|
||||
set_property(SOURCE ${PROJECT_BINARY_DIR}/foo.c PROPERTY
|
||||
OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/subdir/../subdir/subdir.h)
|
||||
|
||||
# Add custom command to generate not_included.h, which is a header
|
||||
# file that is not included by any source in this project. This will
|
||||
# test whether all custom command outputs explicitly listed as sources
|
||||
|
|
|
@ -7,6 +7,11 @@
|
|||
int generated();
|
||||
int wrapped();
|
||||
|
||||
#include "subdir/subdir.h"
|
||||
#ifndef SUBDIR_DEF
|
||||
# error SUBDIR_DEF not defined
|
||||
#endif
|
||||
|
||||
int main ()
|
||||
{
|
||||
if (generated()*wrapped()*doc() == 3*5*7)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
#define SUBDIR_DEF
|
Loading…
Reference in New Issue