Merge topic 'autorcc-target-dir'

33774ca2 QtAutogen: Put generated qrc files in a target-specific dir.
This commit is contained in:
Brad King 2014-04-21 09:32:27 -04:00 committed by CMake Topic Stage
commit 464c8ab3a2
3 changed files with 12 additions and 2 deletions

View File

@ -16,6 +16,7 @@ set(AM_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@/")
set(AM_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/") set(AM_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/")
set(AM_QT_VERSION_MAJOR "@_target_qt_version@") set(AM_QT_VERSION_MAJOR "@_target_qt_version@")
set(AM_TARGET_NAME @_moc_target_name@) set(AM_TARGET_NAME @_moc_target_name@)
set(AM_ORIGIN_TARGET_NAME @_origin_target_name@)
set(AM_RELAXED_MODE "@_moc_relaxed_mode@") set(AM_RELAXED_MODE "@_moc_relaxed_mode@")
set(AM_UIC_TARGET_OPTIONS @_uic_target_options@) set(AM_UIC_TARGET_OPTIONS @_uic_target_options@)
set(AM_UIC_OPTIONS_FILES @_qt_uic_options_files@) set(AM_UIC_OPTIONS_FILES @_qt_uic_options_files@)

View File

@ -367,6 +367,8 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target)
makefile->AddDefinition("_moc_target_name", makefile->AddDefinition("_moc_target_name",
cmLocalGenerator::EscapeForCMake(autogenTargetName).c_str()); cmLocalGenerator::EscapeForCMake(autogenTargetName).c_str());
makefile->AddDefinition("_origin_target_name",
cmLocalGenerator::EscapeForCMake(target->GetName()).c_str());
std::string targetDir = getAutogenTargetDir(target); std::string targetDir = getAutogenTargetDir(target);
@ -506,7 +508,9 @@ void cmQtAutoGenerators::SetupSourceFiles(cmTarget const* target)
std::string basename = cmsys::SystemTools:: std::string basename = cmsys::SystemTools::
GetFilenameWithoutLastExtension(absFile); GetFilenameWithoutLastExtension(absFile);
std::string rcc_output_file = makefile->GetCurrentOutputDirectory(); std::string rcc_output_dir = target->GetSupportDirectory();
cmSystemTools::MakeDirectory(rcc_output_dir.c_str());
std::string rcc_output_file = rcc_output_dir;
rcc_output_file += "/qrc_" + basename + ".cpp"; rcc_output_file += "/qrc_" + basename + ".cpp";
makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
rcc_output_file.c_str(), false); rcc_output_file.c_str(), false);
@ -1063,6 +1067,8 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile,
this->ProjectBinaryDir = makefile->GetSafeDefinition("AM_CMAKE_BINARY_DIR"); this->ProjectBinaryDir = makefile->GetSafeDefinition("AM_CMAKE_BINARY_DIR");
this->ProjectSourceDir = makefile->GetSafeDefinition("AM_CMAKE_SOURCE_DIR"); this->ProjectSourceDir = makefile->GetSafeDefinition("AM_CMAKE_SOURCE_DIR");
this->TargetName = makefile->GetSafeDefinition("AM_TARGET_NAME"); this->TargetName = makefile->GetSafeDefinition("AM_TARGET_NAME");
this->OriginTargetName
= makefile->GetSafeDefinition("AM_ORIGIN_TARGET_NAME");
{ {
const char *uicOptionsFiles const char *uicOptionsFiles
@ -2057,7 +2063,9 @@ bool cmQtAutoGenerators::GenerateQrc()
std::string basename = cmsys::SystemTools:: std::string basename = cmsys::SystemTools::
GetFilenameWithoutLastExtension(*si); GetFilenameWithoutLastExtension(*si);
std::string rcc_output_file = this->Builddir + "qrc_" + basename + ".cpp"; std::string rcc_output_file = this->Builddir
+ "CMakeFiles/" + this->OriginTargetName
+ ".dir/qrc_" + basename + ".cpp";
int sourceNewerThanQrc = 0; int sourceNewerThanQrc = 0;
bool success = cmsys::SystemTools::FileTimeCompare(si->c_str(), bool success = cmsys::SystemTools::FileTimeCompare(si->c_str(),

View File

@ -104,6 +104,7 @@ private:
std::string ProjectBinaryDir; std::string ProjectBinaryDir;
std::string ProjectSourceDir; std::string ProjectSourceDir;
std::string TargetName; std::string TargetName;
std::string OriginTargetName;
std::string CurrentCompileSettingsStr; std::string CurrentCompileSettingsStr;
std::string OldCompileSettingsStr; std::string OldCompileSettingsStr;