summaryrefslogtreecommitdiffstats
path: root/Source/cmPolicies.cxx
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2010-11-17 21:32:53 (GMT)
committerBrad King <brad.king@kitware.com>2011-01-04 13:06:20 (GMT)
commitdb44848f441673909e909755d7b833aa474791c7 (patch)
treeac9f6a49c40a6c050947237d1d470e96b8cb7468 /Source/cmPolicies.cxx
parent1e69c6f37fa4a3a1a0c2f8fa665ad07a78fed580 (diff)
downloadCMake-db44848f441673909e909755d7b833aa474791c7.zip
CMake-db44848f441673909e909755d7b833aa474791c7.tar.gz
CMake-db44848f441673909e909755d7b833aa474791c7.tar.bz2
Prefer files from CMAKE_ROOT when including from CMAKE_ROOT
This patch makes include() and find_package() prefer cmake files located in CMAKE_ROOT over those in CMAKE_MODULE_PATH. This makes sure that the including file gets that file included which it expects, i.e. the one from cmake with which it was tested. It only changes behaviour when such an included file exists both in CMAKE_MODULE_PATH and in CMAKE_ROOT. This comes together with a new policy CMP0017, with default behaviour it behaves as it always did, but warns. With NEW behaviour it includes the file from CMAKE_ROOT instead from CMAKE_MODULE_PATH. This fixes (if CMP0017 is set) building KDE 4.5 with cmake >= 2.8.3. Also a basic test for this policy in included.
Diffstat (limited to 'Source/cmPolicies.cxx')
-rw-r--r--Source/cmPolicies.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index fccf0cc..34c74c2 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -446,6 +446,22 @@ cmPolicies::cmPolicies()
"wasn't a valid target. "
"In CMake 2.8.3 and above it reports an error in this case.",
2,8,3,0, cmPolicies::WARN);
+
+ this->DefinePolicy(
+ CMP0017, "CMP0017",
+ "Prefer files from CMAKE_ROOT/ when including from CMAKE_ROOT.",
+ "Starting with CMake 2.8.3, if a cmake-module shipped with CMake (i.e. "
+ "located in CMAKE_ROOT/Modules/) calls include() or find_package(), "
+ "the files located in CMAKE_ROOT/Modules/ are prefered over the files "
+ "in CMAKE_MODULE_PATH. This makes sure that the modules belonging to "
+ "CMake always get those files included which they expect, and against "
+ "which they were developed and tested. "
+ "In call other cases, the files found in "
+ "CMAKE_MODULE_PATH still take precedence over the ones in "
+ "CMAKE_ROOT/Modules/. "
+ "The OLD behaviour is to always prefer files from CMAKE_MODULE_PATH over "
+ "files from CMAKE_ROOT/Modules/.",
+ 2,8,3,0, cmPolicies::WARN);
}
cmPolicies::~cmPolicies()