summaryrefslogtreecommitdiffstats
path: root/Source/cmAddCustomCommandCommand.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2002-01-03 21:02:43 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2002-01-03 21:02:43 (GMT)
commit58ee8555032478147f46d1876291feb6a9a57904 (patch)
tree74f89187ae9f34050372741018bbffd99a8c9ae0 /Source/cmAddCustomCommandCommand.cxx
parent0333f15b96ebe0308ef3d04a0ec9a434d3a0be40 (diff)
downloadCMake-58ee8555032478147f46d1876291feb6a9a57904.zip
CMake-58ee8555032478147f46d1876291feb6a9a57904.tar.gz
CMake-58ee8555032478147f46d1876291feb6a9a57904.tar.bz2
Fix add custom command so that it actually executes the code
Diffstat (limited to 'Source/cmAddCustomCommandCommand.cxx')
-rw-r--r--Source/cmAddCustomCommandCommand.cxx25
1 files changed, 25 insertions, 0 deletions
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index e9ee41f..c4c45a2 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -31,6 +31,7 @@ bool cmAddCustomCommandCommand::InitialPass(std::vector<std::string> const& args
std::string source, command, target;
std::vector<std::string> command_args, depends, outputs;
+ std::string outDir = m_Makefile->GetCurrentOutputDirectory();
enum tdoing {
doing_source,
@@ -129,7 +130,31 @@ bool cmAddCustomCommandCommand::InitialPass(std::vector<std::string> const& args
depends,
outputs,
target.c_str());
+
+ int cc = outputs.size()-1;
+ while( cc >= 0 )
+ {
+ std::string fileName = outputs[cc];
+
+ std::string directory = cmSystemTools::GetFilenamePath(fileName);
+ if ( directory == std::string() )
+ {
+ directory = outDir;
+ }
+ fileName = cmSystemTools::GetFilenameName(fileName);
+
+ std::string::size_type pos = fileName.rfind(".");
+ fileName = fileName.substr(0, pos);
+ // Add the generated source to the package target's source list.
+ cmSourceFile file;
+ file.SetName(fileName.c_str(), directory.c_str(), "c", false);
+ m_Makefile->AddSource(file, target.c_str());
+ cc--;
+ }
+ m_Makefile->GetTargets()[target.c_str()].GetSourceLists().push_back(target);
+
return true;
}
+