From 60cb75e4a196c97e55d535486e2d28630afb3f6e Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Tue, 24 Apr 2018 12:16:20 +0200 Subject: Fix CMAKE_DISABLE_SOURCE_CHANGES recognition of top of build tree The change in commit v3.11.0-rc1~480^2 (UseJava: add_jar OUTPUT_DIR option used only for jar generation, 2017-10-12) added code of the form `file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR})`. This exposed an existing bug in `CMAKE_DISABLE_SOURCE_CHANGES` in which it does not recognize that the top of the build tree itself is in the build tree. Fix that now. Fixes: #17933 --- Source/cmMakefile.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 71359a2..604ca2c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2304,7 +2304,8 @@ bool cmMakefile::CanIWriteThisFile(std::string const& fileName) const } return !cmSystemTools::IsSubDirectory(fileName, this->GetHomeDirectory()) || - cmSystemTools::IsSubDirectory(fileName, this->GetHomeOutputDirectory()); + cmSystemTools::IsSubDirectory(fileName, this->GetHomeOutputDirectory()) || + cmSystemTools::SameFile(fileName, this->GetHomeOutputDirectory()); } const char* cmMakefile::GetRequiredDefinition(const std::string& name) const -- cgit v0.12