ENH: change workings of command so that it can all happing in the initial pass still works the old way but complains
This commit is contained in:
parent
f0b8cecf9d
commit
c25e2b9b97
|
@ -96,11 +96,44 @@ bool cmFLTKWrapUICommand::InitialPass(std::vector<std::string> const& args)
|
|||
}
|
||||
}
|
||||
|
||||
// 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()
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
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();
|
||||
|
||||
|
@ -111,6 +144,7 @@ void cmFLTKWrapUICommand::FinalPass()
|
|||
m_GeneratedSourcesClasses[classNum]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -71,7 +71,8 @@ public:
|
|||
" FLTK_WRAP_UI(resultingLibraryName source1\n"
|
||||
" source2 ... sourceN )\n"
|
||||
"Produce .h and .cxx files for all the .fl and .fld files listed. "
|
||||
"The resulting .h and .cxx files will be added to the specified "
|
||||
"The resulting .h and .cxx files will be added to a variable named "
|
||||
"resultingLibraryName_FLTK_UI_SRCS whcih should be added to your "
|
||||
"library.";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue