summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalVisualStudio7Generator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-01-11 19:32:13 (GMT)
committerBrad King <brad.king@kitware.com>2018-01-12 19:27:37 (GMT)
commit506fda1cf026a88378589009b62ca8bf633c5197 (patch)
tree2095056002a42332f5e8f2741daa29eb8880db10 /Source/cmLocalVisualStudio7Generator.cxx
parentc2f79c98677d43fb8686f9e4309acddfae8f3dfd (diff)
downloadCMake-506fda1cf026a88378589009b62ca8bf633c5197.zip
CMake-506fda1cf026a88378589009b62ca8bf633c5197.tar.gz
CMake-506fda1cf026a88378589009b62ca8bf633c5197.tar.bz2
Genex: Enable COMPILE_LANGUAGE for INCLUDE_DIRECTORIES with VS and Xcode
The set of compile flags used for a target's C and C++ sources is based on the linker language. By default this is always the C++ flags if any C++ sources appear in the target, and otherwise the C flags. Therefore we can define the `COMPILE_LANGUAGE` generator expression in `INCLUDE_DIRECTORIES` to match the selected language. This is not exactly the same as for other generators, but is the best VS and Xcode can do. It is also sufficient for many use cases since the set of include directories for C and C++ is frequently similar but may be distinct from those for other languages like CUDA. Fixes: #17435
Diffstat (limited to 'Source/cmLocalVisualStudio7Generator.cxx')
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx24
1 files changed, 17 insertions, 7 deletions
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 003163e..59c20a9 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -796,10 +796,13 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
<< "\\$(ConfigurationName)\"\n";
}
fout << "\t\t\t\tAdditionalIncludeDirectories=\"";
- std::vector<std::string> includes;
- this->GetIncludeDirectories(includes, target, "C", configName);
- std::vector<std::string>::iterator i = includes.begin();
- for (; i != includes.end(); ++i) {
+ std::vector<std::string> includes_cl;
+ if (!langForClCompile.empty()) {
+ this->GetIncludeDirectories(includes_cl, target, langForClCompile,
+ configName);
+ }
+ std::vector<std::string>::iterator i = includes_cl.begin();
+ for (; i != includes_cl.end(); ++i) {
// output the include path
std::string ipath = this->ConvertToXMLOutputPath(i->c_str());
fout << ipath << ";";
@@ -834,9 +837,12 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
"\t\t\t\tName=\"MASM\"\n"
"\t\t\t\tIncludePaths=\""
;
+ std::vector<std::string> includes_masm;
+ this->GetIncludeDirectories(includes_masm, target, "ASM_MASM",
+ configName);
/* clang-format on */
const char* sep = "";
- for (i = includes.begin(); i != includes.end(); ++i) {
+ for (i = includes_masm.begin(); i != includes_masm.end(); ++i) {
std::string inc = *i;
cmConvertToWindowsSlash(inc);
fout << sep << this->EscapeForXML(inc);
@@ -864,7 +870,9 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
}
fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\"\n"
<< "\t\t\t\tAdditionalIncludeDirectories=\"";
- for (i = includes.begin(); i != includes.end(); ++i) {
+ std::vector<std::string> includes_rc;
+ this->GetIncludeDirectories(includes_rc, target, "RC", configName);
+ for (i = includes_rc.begin(); i != includes_rc.end(); ++i) {
std::string ipath = this->ConvertToXMLOutputPath(i->c_str());
fout << ipath << ";";
}
@@ -878,7 +886,9 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
}
fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\"\n";
fout << "\t\t\t\tAdditionalIncludeDirectories=\"";
- for (i = includes.begin(); i != includes.end(); ++i) {
+ std::vector<std::string> includes_midl;
+ this->GetIncludeDirectories(includes_midl, target, "MIDL", configName);
+ for (i = includes_midl.begin(); i != includes_midl.end(); ++i) {
std::string ipath = this->ConvertToXMLOutputPath(i->c_str());
fout << ipath << ";";
}