diff options
author | Brad King <brad.king@kitware.com> | 2014-12-08 20:12:51 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-12-08 20:35:50 (GMT) |
commit | ce331bab929c5a38e048ba15d7393dcf96fad9e1 (patch) | |
tree | 21357d2d12d5b425b596bca81cbd70e91b912ba0 /Source/cmGlobalGenerator.h | |
parent | 09498b2ead29a64816e5c301b7465164cec25c1c (diff) | |
download | CMake-ce331bab929c5a38e048ba15d7393dcf96fad9e1.zip CMake-ce331bab929c5a38e048ba15d7393dcf96fad9e1.tar.gz CMake-ce331bab929c5a38e048ba15d7393dcf96fad9e1.tar.bz2 |
find_library: Fix repeat call after changing directory content (#15293)
We use cmGlobalGenerator::GetDirectoryContent to avoid repeating
directory listings. However, GetDirectoryContent loads content from
disk at most once. This breaks find_library calls that occur when disk
content has changed since preceding find_library calls.
Teach cmGlobalGenerator::GetDirectoryContent to save the directory
modification time when content is loaded and re-load content if it
changes.
Create a RunCMake.find_library test with a case covering this.
Diffstat (limited to 'Source/cmGlobalGenerator.h')
-rw-r--r-- | Source/cmGlobalGenerator.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 6b75298..08f061a 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -255,9 +255,9 @@ public: cmTargetManifest const& GetTargetManifest() const { return this->TargetManifest; } - /** Get the content of a directory. Directory listings are loaded - from disk at most once and cached. During the generation step - the content will include the target files to be built even if + /** Get the content of a directory. Directory listings are cached + and re-loaded from disk only when modified. During the generation + step the content will include the target files to be built even if they do not yet exist. */ std::set<std::string> const& GetDirectoryContent(std::string const& dir, bool needDisk = true); @@ -486,13 +486,14 @@ private: virtual const char* GetBuildIgnoreErrorsFlag() const { return 0; } // Cache directory content and target files to be built. - struct DirectoryContent: public std::set<std::string> + struct DirectoryContent { - typedef std::set<std::string> derived; - bool LoadedFromDisk; - DirectoryContent(): LoadedFromDisk(false) {} + long LastDiskTime; + std::set<std::string> All; + std::set<std::string> Generated; + DirectoryContent(): LastDiskTime(-1) {} DirectoryContent(DirectoryContent const& dc): - derived(dc), LoadedFromDisk(dc.LoadedFromDisk) {} + LastDiskTime(dc.LastDiskTime), All(dc.All), Generated(dc.Generated) {} }; std::map<std::string, DirectoryContent> DirectoryContentMap; |