summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-05-29 13:58:47 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-05-29 13:58:47 (GMT)
commit8afbb346c67c60dcf9383f5e58307d629eafb855 (patch)
treee927b24f33701f9721e63d05185f4340da1b1ba8
parent7e011a3db33b7979906482776c3747b42e1d2887 (diff)
parentc4af46b4443374f0a0a64bb7db87750454cc3dac (diff)
downloadCMake-8afbb346c67c60dcf9383f5e58307d629eafb855.zip
CMake-8afbb346c67c60dcf9383f5e58307d629eafb855.tar.gz
CMake-8afbb346c67c60dcf9383f5e58307d629eafb855.tar.bz2
Merge topic 'normalize-custom-command-paths'
c4af46b4 add_custom_command: Normalize OUTPUT and DEPENDS paths.
-rw-r--r--Source/cmAddCustomCommandCommand.cxx4
-rw-r--r--Source/cmCustomCommandGenerator.cxx12
-rw-r--r--Tests/CustomCommand/CMakeLists.txt27
3 files changed, 42 insertions, 1 deletions
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index d5f00ff..6a95550 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -173,6 +173,10 @@ bool cmAddCustomCommandCommand
break;
}
+ if (cmSystemTools::FileIsFullPath(filename.c_str()))
+ {
+ filename = cmSystemTools::CollapseFullPath(filename);
+ }
switch (doing)
{
case doing_working_directory:
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index cebd9f5..ebfbf7c 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -103,8 +103,18 @@ std::vector<std::string> const& cmCustomCommandGenerator::GetDepends() const
{
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge
= this->GE->Parse(*i);
+ std::vector<std::string> result;
cmSystemTools::ExpandListArgument(
- cge->Evaluate(this->Makefile, this->Config), this->Depends);
+ cge->Evaluate(this->Makefile, this->Config), result);
+ for (std::vector<std::string>::iterator it = result.begin();
+ it != result.end(); ++it)
+ {
+ if (cmSystemTools::FileIsFullPath(it->c_str()))
+ {
+ *it = cmSystemTools::CollapseFullPath(*it);
+ }
+ }
+ this->Depends.insert(this->Depends.end(), result.begin(), result.end());
}
}
return this->Depends;
diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt
index e0854ce..b97cd16 100644
--- a/Tests/CustomCommand/CMakeLists.txt
+++ b/Tests/CustomCommand/CMakeLists.txt
@@ -456,3 +456,30 @@ add_custom_target(source_in_custom_target SOURCES source_in_custom_target.cpp)
set_property(SOURCE source_in_custom_target
PROPERTY COMPILE_DEFINITIONS "TEST"
)
+
+set(gen_path "${CMAKE_CURRENT_BINARY_DIR}//./foo")
+set(gen_file "${gen_path}/foo.cxx")
+
+add_custom_command(
+ OUTPUT "${gen_file}"
+ # Make sure the output directory exists before trying to write to it.
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${gen_path}"
+ COMMAND ${CMAKE_COMMAND} -E touch "${gen_file}"
+)
+
+add_library(NormOutput "${gen_file}")
+
+set(gen_path "${gen_path}/bar")
+set(gen_file "${gen_path}/bar.cxx")
+
+add_custom_command(
+ OUTPUT "${gen_path}"
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${gen_path}"
+)
+
+add_custom_command(
+ OUTPUT "${gen_file}"
+ DEPENDS "${gen_path}"
+ COMMAND ${CMAKE_COMMAND} -E touch "${gen_file}")
+
+add_library(NormDepends "${gen_file}")