summaryrefslogtreecommitdiffstats
path: root/Source/cmFLTKWrapUICommand.cxx
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2005-06-10 14:09:17 (GMT)
committerKen Martin <ken.martin@kitware.com>2005-06-10 14:09:17 (GMT)
commitc25e2b9b97a5ccfa171bc8b41b4a84adafaaa499 (patch)
tree96314b935d66ee4cb54dfd3e481f91c81d7e6f06 /Source/cmFLTKWrapUICommand.cxx
parentf0b8cecf9d17ed596f26b78f9298c28c6b27b5df (diff)
downloadCMake-c25e2b9b97a5ccfa171bc8b41b4a84adafaaa499.zip
CMake-c25e2b9b97a5ccfa171bc8b41b4a84adafaaa499.tar.gz
CMake-c25e2b9b97a5ccfa171bc8b41b4a84adafaaa499.tar.bz2
ENH: change workings of command so that it can all happing in the initial pass still works the old way but complains
Diffstat (limited to 'Source/cmFLTKWrapUICommand.cxx')
-rw-r--r--Source/cmFLTKWrapUICommand.cxx48
1 files changed, 41 insertions, 7 deletions
diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx
index 6fda96e..45d913f 100644
--- a/Source/cmFLTKWrapUICommand.cxx
+++ b/Source/cmFLTKWrapUICommand.cxx
@@ -95,20 +95,54 @@ bool cmFLTKWrapUICommand::InitialPass(std::vector<std::string> const& args)
m_GeneratedSourcesClasses.push_back(sf);
}
}
+
+ // create the variable with the list of sources in it
+ size_t lastHeadersClass = m_GeneratedSourcesClasses.size();
+ std::string sourceListValue;
+ for(size_t classNum = 0; classNum < lastHeadersClass; classNum++)
+ {
+ if (classNum)
+ {
+ sourceListValue += ";";
+ }
+ sourceListValue += m_GeneratedSourcesClasses[classNum]->GetFullPath();
+ }
+ std::string varName = m_Target;
+ varName += "_FLTK_UI_SRCS";
+ m_Makefile->AddDefinition(varName.c_str(), sourceListValue.c_str());
return true;
}
void cmFLTKWrapUICommand::FinalPass()
{
- // first we add the rules for all the .fl to .h and .cxx files
- size_t lastHeadersClass = m_GeneratedSourcesClasses.size();
-
- // Generate code for all the .fl files
- for(size_t classNum = 0; classNum < lastHeadersClass; classNum++)
+ // people should add the srcs to the target themselves, but the old command
+ // didn't support that, so check and see if they added the files in and if
+ // they didn;t then print a warning and add then anyhow
+ std::vector<std::string> srcs =
+ m_Makefile->GetTargets()[m_Target].GetSourceLists();
+ bool found = false;
+ for (unsigned int i = 0; i < srcs.size(); ++i)
+ {
+ if (srcs[i] ==
+ m_GeneratedSourcesClasses[0]->GetFullPath())
+ {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
{
- m_Makefile->GetTargets()[m_Target].GetSourceFiles().push_back(
- m_GeneratedSourcesClasses[classNum]);
+ cmSystemTools::Message("In CMake 2.2 the FLT_WRAP_UI command sets a variable to the list of source files that should be added to your executable or library. It appears that you have not added these source files to your target. You should change your CMakeLists.txt file to directly add the generated files to the target. For example FTLK_WRAP_UI(foo src1 src2 src3) will create a variable named foo_FLTK_UI_SRCS that contains the list of sources to add to your target when you call ADD_LIBRARY or ADD_EXECUTABLE. For now CMake 2.2 will add the sources to your target for you as was done in CMake 2.0 and earlier. In the future this may become an error.","Warning");
+ // first we add the rules for all the .fl to .h and .cxx files
+ size_t lastHeadersClass = m_GeneratedSourcesClasses.size();
+
+ // Generate code for all the .fl files
+ for(size_t classNum = 0; classNum < lastHeadersClass; classNum++)
+ {
+ m_Makefile->GetTargets()[m_Target].GetSourceFiles().push_back(
+ m_GeneratedSourcesClasses[classNum]);
+ }
}
}