summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-01-29 14:13:53 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-01-29 14:13:53 (GMT)
commitabec4213d61cb74aba5da6f83220b38ef7882209 (patch)
treedeb91704649b5bfe0fcc2eac8ff12f2382578dea
parent5968ad58fd85e9703c36cd9154137f24c55e5413 (diff)
parent9259d7788193ad23aa429652af983afc3bc4a953 (diff)
downloadCMake-abec4213d61cb74aba5da6f83220b38ef7882209.zip
CMake-abec4213d61cb74aba5da6f83220b38ef7882209.tar.gz
CMake-abec4213d61cb74aba5da6f83220b38ef7882209.tar.bz2
Merge topic 'fix-OBJECT_DEPENDS-after-path-normalization'
9259d778 Normalize OBJECT_DEPENDS paths to match custom commands (#15366)
-rw-r--r--Source/cmGeneratorTarget.cxx8
-rw-r--r--Source/cmNinjaTargetGenerator.cxx8
-rw-r--r--Tests/CustomCommand/CMakeLists.txt13
-rw-r--r--Tests/CustomCommand/foo.in5
-rw-r--r--Tests/CustomCommand/subdir.h.in1
5 files changed, 35 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 8d18c3a..a4f099b 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -663,6 +663,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);
}
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 67824c6..ff41f6d 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -605,6 +605,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());
}
diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt
index 57ffeec..268069d 100644
--- a/Tests/CustomCommand/CMakeLists.txt
+++ b/Tests/CustomCommand/CMakeLists.txt
@@ -154,6 +154,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
diff --git a/Tests/CustomCommand/foo.in b/Tests/CustomCommand/foo.in
index e43aed1..15d2d2c 100644
--- a/Tests/CustomCommand/foo.in
+++ b/Tests/CustomCommand/foo.in
@@ -6,6 +6,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)
diff --git a/Tests/CustomCommand/subdir.h.in b/Tests/CustomCommand/subdir.h.in
new file mode 100644
index 0000000..1e50750
--- /dev/null
+++ b/Tests/CustomCommand/subdir.h.in
@@ -0,0 +1 @@
+#define SUBDIR_DEF