diff options
author | Brad King <brad.king@kitware.com> | 2015-08-24 14:06:54 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-08-24 14:06:54 (GMT) |
commit | aaf9532bbc2b45288de3350fa9379c10315c98d4 (patch) | |
tree | 5b637b5d24f28029900e62cc189bde2e8b99e253 | |
parent | 884c63176f79b03e1cb57a24ad70760be000214d (diff) | |
parent | a4bd30104fe6df3e4a6a37d0abb640a28126009d (diff) | |
download | CMake-aaf9532bbc2b45288de3350fa9379c10315c98d4.zip CMake-aaf9532bbc2b45288de3350fa9379c10315c98d4.tar.gz CMake-aaf9532bbc2b45288de3350fa9379c10315c98d4.tar.bz2 |
Merge topic 'fix-include_directories-BEFORE'
a4bd3010 include_directories: Fix regression in BEFORE option (#15693)
-rw-r--r-- | Source/cmState.cxx | 11 | ||||
-rw-r--r-- | Tests/RunCMake/include_directories/DirectoryBefore-stdout.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/include_directories/DirectoryBefore.cmake | 4 | ||||
-rw-r--r-- | Tests/RunCMake/include_directories/RunCMakeTest.cmake | 1 |
4 files changed, 11 insertions, 6 deletions
diff --git a/Source/cmState.cxx b/Source/cmState.cxx index f425861..4ad6d3b 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -1296,22 +1296,21 @@ void cmState::Directory::PrependIncludeDirectoriesEntry( this->DirectoryState->IncludeDirectories.begin() + this->Snapshot_.Position->IncludeDirectoryPosition; - std::vector<std::string>::const_reverse_iterator rend = + std::vector<std::string>::reverse_iterator rend = this->DirectoryState->IncludeDirectories.rend(); std::vector<std::string>::reverse_iterator rbegin = cmMakeReverseIterator(entryEnd); - std::vector<std::string>::const_reverse_iterator crbegin = rbegin; - crbegin = std::find(crbegin, rend, cmPropertySentinal); + rbegin = std::find(rbegin, rend, cmPropertySentinal); - std::vector<std::string>::const_iterator entryIt = crbegin.base(); - std::vector<std::string>::const_iterator entryBegin = + std::vector<std::string>::iterator entryIt = rbegin.base(); + std::vector<std::string>::iterator entryBegin = this->DirectoryState->IncludeDirectories.begin(); std::vector<cmListFileBacktrace>::iterator btIt = this->DirectoryState->IncludeDirectoryBacktraces.begin() + std::distance(entryBegin, entryIt); - this->DirectoryState->IncludeDirectories.insert(rbegin.base(), vec); + this->DirectoryState->IncludeDirectories.insert(entryIt, vec); this->DirectoryState->IncludeDirectoryBacktraces.insert(btIt, lfbt); this->Snapshot_.Position->IncludeDirectoryPosition = diff --git a/Tests/RunCMake/include_directories/DirectoryBefore-stdout.txt b/Tests/RunCMake/include_directories/DirectoryBefore-stdout.txt new file mode 100644 index 0000000..e986082 --- /dev/null +++ b/Tests/RunCMake/include_directories/DirectoryBefore-stdout.txt @@ -0,0 +1 @@ +-- INCLUDE_DIRECTORIES: '[^;]*/Tests/RunCMake/include_directories/BeforeDir;[^;]*/Tests/RunCMake/include_directories/AfterDir' diff --git a/Tests/RunCMake/include_directories/DirectoryBefore.cmake b/Tests/RunCMake/include_directories/DirectoryBefore.cmake new file mode 100644 index 0000000..be3f663 --- /dev/null +++ b/Tests/RunCMake/include_directories/DirectoryBefore.cmake @@ -0,0 +1,4 @@ +include_directories(AfterDir) +include_directories(BEFORE BeforeDir) +get_property(dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES) +message(STATUS "INCLUDE_DIRECTORIES: '${dirs}'") diff --git a/Tests/RunCMake/include_directories/RunCMakeTest.cmake b/Tests/RunCMake/include_directories/RunCMakeTest.cmake index 54d5e97..57e8274 100644 --- a/Tests/RunCMake/include_directories/RunCMakeTest.cmake +++ b/Tests/RunCMake/include_directories/RunCMakeTest.cmake @@ -5,6 +5,7 @@ set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/NotDefa run_cmake(NotFoundContent) run_cmake(DebugIncludes) +run_cmake(DirectoryBefore) run_cmake(TID-bad-target) run_cmake(ImportedTarget) run_cmake(CMP0021) |