diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2019-09-08 13:27:02 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2019-09-16 16:18:48 (GMT) |
commit | 05126d23f6a285731dfef940012c6b78feb9fa62 (patch) | |
tree | bf5ba7ee2514cbffa2bfdcc95bad591c65c0d810 | |
parent | f54c5ee52195ae2d73a54faef9399ab977b83a1b (diff) | |
download | CMake-05126d23f6a285731dfef940012c6b78feb9fa62.zip CMake-05126d23f6a285731dfef940012c6b78feb9fa62.tar.gz CMake-05126d23f6a285731dfef940012c6b78feb9fa62.tar.bz2 |
Autogen: Remove CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE sort duplication
This removes code that sorts include directories for `AUTOMOC` according to
`CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE`. This is possible because the
included directories passed to `AUTOMOC` are already sorted, also with
respect to `CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE`.
-rw-r--r-- | Source/cmQtAutoGenInitializer.cxx | 2 | ||||
-rw-r--r-- | Source/cmQtAutoMocUic.cxx | 44 | ||||
-rw-r--r-- | Source/cmQtAutoMocUic.h | 1 |
3 files changed, 4 insertions, 43 deletions
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index c6c71ab..7012ef6 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -1247,8 +1247,6 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo() MfDef("CMAKE_CURRENT_SOURCE_DIR")); ofs.Write("AM_CMAKE_CURRENT_BINARY_DIR", MfDef("CMAKE_CURRENT_BINARY_DIR")); - ofs.Write("AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE", - MfDef("CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE")); ofs.Write("AM_BUILD_DIR", this->Dir.Build); ofs.Write("AM_INCLUDE_DIR", this->Dir.Include); ofs.WriteConfig("AM_INCLUDE_DIR", this->Dir.ConfigInclude); diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index 3e30a2f..c305ca6 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -2,14 +2,6 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmQtAutoMocUic.h" -#include <algorithm> -#include <initializer_list> -#include <list> -#include <set> -#include <utility> - -#include "cm_memory.hxx" - #include "cmAlgorithms.h" #include "cmCryptoHash.h" #include "cmGeneratedFileStream.h" @@ -17,9 +9,13 @@ #include "cmQtAutoGen.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" +#include "cm_memory.hxx" #include "cmake.h" #include "cmsys/FStream.hxx" +#include <algorithm> +#include <set> +#include <utility> #if defined(__APPLE__) # include <unistd.h> #endif @@ -1545,8 +1541,6 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile) makefile->GetCMakeInstance()->GetHeaderExtensions(); // - Files and directories - BaseConst_.IncludeProjectDirsBefore = - InfoGetBool("AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE"); BaseConst_.ProjectSourceDir = InfoGet("AM_CMAKE_SOURCE_DIR"); BaseConst_.ProjectBinaryDir = InfoGet("AM_CMAKE_BINARY_DIR"); BaseConst_.CurrentSourceDir = InfoGet("AM_CMAKE_CURRENT_SOURCE_DIR"); @@ -1786,35 +1780,6 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile) MocConst_.PredefsFileAbs = AbsoluteBuildPath(MocConst().PredefsFileRel); } - // Sort include directories on demand - if (BaseConst().IncludeProjectDirsBefore) { - // Move strings to temporary list - std::list<std::string> includes(MocConst().IncludePaths.begin(), - MocConst().IncludePaths.end()); - MocConst_.IncludePaths.clear(); - MocConst_.IncludePaths.reserve(includes.size()); - // Append project directories only - { - std::initializer_list<cm::string_view> const movePaths = { - BaseConst().ProjectBinaryDir, BaseConst().ProjectSourceDir - }; - for (cm::string_view const& ppath : movePaths) { - auto it = includes.begin(); - while (it != includes.end()) { - std::string const& path = *it; - if (cmHasPrefix(path, ppath)) { - MocConst_.IncludePaths.push_back(path); - it = includes.erase(it); - } else { - ++it; - } - } - } - } - // Append remaining directories - MocConst_.IncludePaths.insert(MocConst_.IncludePaths.end(), - includes.begin(), includes.end()); - } // Compose moc includes list { std::set<std::string> frameworkPaths; @@ -1924,7 +1889,6 @@ void cmQtAutoMocUic::SettingsFileRead() cha(MocConst().Executable); std::for_each(MocConst().AllOptions.begin(), MocConst().AllOptions.end(), cha); - cha(BaseConst().IncludeProjectDirsBefore ? "TRUE" : "FALSE"); std::for_each(MocConst().PredefsCmd.begin(), MocConst().PredefsCmd.end(), cha); for (auto const& filter : MocConst().DependFilters) { diff --git a/Source/cmQtAutoMocUic.h b/Source/cmQtAutoMocUic.h index 549b088..2f6ebff 100644 --- a/Source/cmQtAutoMocUic.h +++ b/Source/cmQtAutoMocUic.h @@ -178,7 +178,6 @@ public: // -- Attributes // - Config bool MultiConfig = false; - bool IncludeProjectDirsBefore = false; unsigned int QtVersionMajor = 4; // - Directories std::string ProjectSourceDir; |