diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2017-05-15 08:37:42 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2017-05-26 13:23:21 (GMT) |
commit | 0965002e57f7461d290792252b289fda9247d530 (patch) | |
tree | eb1b492d6dbe1aefb8231dfd6c75ed143f4ea757 | |
parent | 83e4a8e63713c3e99f81aac2973763c6252846bc (diff) | |
download | CMake-0965002e57f7461d290792252b289fda9247d530.zip CMake-0965002e57f7461d290792252b289fda9247d530.tar.gz CMake-0965002e57f7461d290792252b289fda9247d530.tar.bz2 |
Autogen: Pass build directory in Info file
-rw-r--r-- | Modules/AutogenInfo.cmake.in | 1 | ||||
-rw-r--r-- | Source/cmQtAutoGeneratorInitializer.cxx | 12 | ||||
-rw-r--r-- | Source/cmQtAutoGenerators.cxx | 32 | ||||
-rw-r--r-- | Source/cmQtAutoGenerators.h | 2 |
4 files changed, 25 insertions, 22 deletions
diff --git a/Modules/AutogenInfo.cmake.in b/Modules/AutogenInfo.cmake.in index 5e945bc..9b4941c 100644 --- a/Modules/AutogenInfo.cmake.in +++ b/Modules/AutogenInfo.cmake.in @@ -7,6 +7,7 @@ set(AM_CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@/") set(AM_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@/") set(AM_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/") set(AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE "@CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE@") +set(AM_BUILD_DIR @_autogen_build_dir@) set(AM_SOURCES @_sources@) set(AM_HEADERS @_headers@) # Qt environment diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index 239b18d..bc5095d 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -67,7 +67,7 @@ static std::string GetAutogenTargetFilesDir(cmGeneratorTarget const* target) targetDir += makefile->GetCMakeInstance()->GetCMakeFilesDirectory(); targetDir += "/"; targetDir += GetAutogenTargetName(target); - targetDir += ".dir/"; + targetDir += ".dir"; return targetDir; } @@ -77,7 +77,6 @@ static std::string GetAutogenTargetBuildDir(cmGeneratorTarget const* target) std::string targetDir = makefile->GetCurrentBinaryDirectory(); targetDir += "/"; targetDir += GetAutogenTargetName(target); - targetDir += "/"; return targetDir; } @@ -624,7 +623,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenSources( if (target->GetPropertyAsBool("AUTOMOC")) { cmMakefile* makefile = target->Target->GetMakefile(); std::string mocCppFile = GetAutogenTargetBuildDir(target); - mocCppFile += "moc_compilation.cpp"; + mocCppFile += "/moc_compilation.cpp"; { cmSourceFile* gFile = makefile->GetOrCreateSource(mocCppFile, true); gFile->SetProperty("SKIP_AUTOGEN", "On"); @@ -706,14 +705,14 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( // Create autogen target includes directory and // add it to the origin target INCLUDE_DIRECTORIES if (mocEnabled || uicEnabled) { - const std::string incsDir = autogenBuildDir + "include"; + const std::string incsDir = autogenBuildDir + "/include"; cmSystemTools::MakeDirectory(incsDir); target->AddIncludeDirectory(incsDir, true); } // Register moc compilation file as generated if (mocEnabled) { - autogenProvides.push_back(autogenBuildDir + "moc_compilation.cpp"); + autogenProvides.push_back(autogenBuildDir + "/moc_compilation.cpp"); } #if defined(_WIN32) && !defined(__CYGWIN__) @@ -785,6 +784,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( // Compose rcc output file name { std::string rccOut = autogenBuildDir; + rccOut += "/"; rccOut += fpathCheckSum.getPart(absFile); rccOut += "/qrc_"; rccOut += @@ -919,6 +919,8 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget( } } + AddDefinitionEscaped(makefile, "_autogen_build_dir", + GetAutogenTargetBuildDir(target)); AddDefinitionEscaped(makefile, "_autogen_target_name", autogenTargetName); AddDefinitionEscaped(makefile, "_origin_target_name", target->GetName()); AddDefinitionEscaped(makefile, "_qt_version_major", qtMajorVersion); diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index d40e809..19ae47a 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -372,6 +372,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile( InfoGet(makefile, "AM_CMAKE_CURRENT_BINARY_DIR", this->CurrentBinaryDir); InfoGet(makefile, "AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE", this->IncludeProjectDirsBefore); + InfoGet(makefile, "AM_BUILD_DIR", this->AutogenBuildDir); InfoGet(makefile, "AM_SOURCES", this->Sources); InfoGet(makefile, "AM_HEADERS", this->Headers); @@ -615,18 +616,15 @@ bool cmQtAutoGenerators::SettingsFileWrite() void cmQtAutoGenerators::Init(cmMakefile* makefile) { - this->AutogenBuildSubDir = this->AutogenTargetName; - this->AutogenBuildSubDir += "/"; - - this->MocCppFilenameRel = this->AutogenBuildSubDir; - this->MocCppFilenameRel += "moc_compilation.cpp"; - - this->MocCppFilenameAbs = this->CurrentBinaryDir + this->MocCppFilenameRel; + this->MocCppFilenameRel = "moc_compilation.cpp"; + this->MocCppFilenameAbs = cmSystemTools::CollapseCombinedPath( + this->AutogenBuildDir, this->MocCppFilenameRel); // Moc predefs file if (!this->MocPredefsCmd.empty()) { - this->MocPredefsFileRel = this->AutogenBuildSubDir + "moc_predefs.h"; - this->MocPredefsFileAbs = this->CurrentBinaryDir + this->MocPredefsFileRel; + this->MocPredefsFileRel = "moc_predefs.h"; + this->MocPredefsFileAbs = cmSystemTools::CollapseCombinedPath( + this->AutogenBuildDir, this->MocPredefsFileRel); } // Init file path checksum generator @@ -1335,8 +1333,9 @@ bool cmQtAutoGenerators::MocGenerateFile( bool generateMoc = this->MocSettingsChanged || this->MocPredefsChanged; const std::string mocFileRel = - this->AutogenBuildSubDir + subDir + mocFileName; - const std::string mocFileAbs = this->CurrentBinaryDir + mocFileRel; + cmSystemTools::CollapseCombinedPath(subDir, mocFileName); + const std::string mocFileAbs = + cmSystemTools::CollapseCombinedPath(this->AutogenBuildDir, mocFileRel); if (!generateMoc) { // Test if the source file is newer that the build file @@ -1525,8 +1524,9 @@ bool cmQtAutoGenerators::UicGenerateFile(const std::string& realName, bool generateUic = this->UicSettingsChanged; const std::string uicFileRel = - this->AutogenBuildSubDir + "include/" + uiOutputFile; - const std::string uicFileAbs = this->CurrentBinaryDir + uicFileRel; + cmSystemTools::CollapseCombinedPath("include", uiOutputFile); + const std::string uicFileAbs = + cmSystemTools::CollapseCombinedPath(this->AutogenBuildDir, uicFileRel); if (!generateUic) { // Test if the source file is newer that the build file @@ -1594,8 +1594,7 @@ bool cmQtAutoGenerators::RccGenerateAll() si != this->RccSources.end(); ++si) { const std::string ext = cmsys::SystemTools::GetFilenameLastExtension(*si); if (ext == ".qrc") { - qrcGenMap[*si] = - this->AutogenBuildSubDir + this->ChecksumedPath(*si, "qrc_", ".cpp"); + qrcGenMap[*si] = this->ChecksumedPath(*si, "qrc_", ".cpp"); } } @@ -1636,7 +1635,8 @@ bool cmQtAutoGenerators::RccGenerateFile(const std::string& rccInputFile, bool rccGenerated = false; bool generateRcc = this->RccSettingsChanged; - const std::string rccBuildFile = this->CurrentBinaryDir + rccOutputFile; + const std::string rccBuildFile = + cmSystemTools::CollapseCombinedPath(this->AutogenBuildDir, rccOutputFile); if (!generateRcc) { // Test if the resources list file is newer than build file diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index 987110f..9f329ac 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -165,7 +165,7 @@ private: std::string ProjectBinaryDir; std::string CurrentSourceDir; std::string CurrentBinaryDir; - std::string AutogenBuildSubDir; + std::string AutogenBuildDir; // -- Qt environment std::string QtMajorVersion; std::string MocExecutable; |