summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-01-08 19:32:28 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-01-08 19:32:28 (GMT)
commit6095e9fda68810a98be23750b7a0765967d12679 (patch)
tree54267656062921225eea67aa903ed846d6b076b3 /Source
parentbc414aebaf80cf7a5c67e79e1a5d1f4417164263 (diff)
parent9ce1b9ef2946ead0605e766c7dcf1302fe122f3a (diff)
downloadCMake-6095e9fda68810a98be23750b7a0765967d12679.zip
CMake-6095e9fda68810a98be23750b7a0765967d12679.tar.gz
CMake-6095e9fda68810a98be23750b7a0765967d12679.tar.bz2
Merge topic 'include-dirs-convenience'
9ce1b9e Add CMAKE_BUILD_INTERFACE_INCLUDES build-variable.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmDocumentVariables.cxx11
-rw-r--r--Source/cmGlobalGenerator.cxx17
2 files changed, 28 insertions, 0 deletions
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx
index be45e2d..08b3ef1 100644
--- a/Source/cmDocumentVariables.cxx
+++ b/Source/cmDocumentVariables.cxx
@@ -1147,6 +1147,17 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"Variables that Control the Build");
cm->DefineProperty
+ ("CMAKE_BUILD_INTERFACE_INCLUDES", cmProperty::VARIABLE,
+ "Automatically add the current source- and build directories "
+ "to the INTERFACE_INCLUDE_DIRECTORIES.",
+ "If this variable is enabled, CMake automatically adds for each "
+ "target ${CMAKE_CURRENT_SOURCE_DIR} and ${CMAKE_CURRENT_BINARY_DIR} "
+ "to the INTERFACE_INCLUDE_DIRECTORIES."
+ "By default CMAKE_BUILD_INTERFACE_INCLUDES is OFF.",
+ false,
+ "Variables that Control the Build");
+
+ cm->DefineProperty
("CMAKE_INSTALL_RPATH", cmProperty::VARIABLE,
"The rpath to use for installed targets.",
"A semicolon-separated list specifying the rpath "
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 0f439e9..d030aa7 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -938,6 +938,23 @@ void cmGlobalGenerator::Generate()
(*targets)[tit->first] = tit->second;
(*targets)[tit->first].SetMakefile(mf);
}
+
+ for ( tit = targets->begin(); tit != targets->end(); ++ tit )
+ {
+ if (mf->IsOn("CMAKE_BUILD_INTERFACE_INCLUDES"))
+ {
+ const char *binDir = mf->GetStartOutputDirectory();
+ const char *srcDir = mf->GetStartDirectory();
+ const std::string dirs = std::string(binDir ? binDir : "")
+ + std::string(binDir ? ";" : "")
+ + std::string(srcDir ? srcDir : "");
+ if (!dirs.empty())
+ {
+ tit->second.AppendProperty("INTERFACE_INCLUDE_DIRECTORIES",
+ ("$<BUILD_INTERFACE:" + dirs + ">").c_str());
+ }
+ }
+ }
}
// Add generator specific helper commands