Skip to content
Snippets Groups Projects
Commit c48d2d84 authored by Brad King's avatar Brad King
Browse files

VS: Place per-source preprocessor definitions after target-wide ones

When the VS 2010+ generators were first implemented in commit 7491f529
(ENH: first pass at VS 10, can bootstrap CMake, but many tests still
fail, 2009-06-25, v2.8.0~546), the per-source preprocessor definitions
were placed before target-wide preprocessor definitions for consistency
with the behavior of VS 9 2008 and below.  However, those generators
are not used much anymore.  Instead prefer consistency with the order
used by the Ninja and Makefile generators.
parent 9c33ff4d
No related branches found
No related tags found
No related merge requests found
compile-options-order
---------------------
* The :ref:`Visual Studio Generators` for VS 2010 and above now place
per-source preprocessor definitions after target-wide preprocssor
definitions. This makes VS consistent with the :ref:`Ninja Generators`
and the :ref:`Makefile Generators`.
......@@ -418,7 +418,9 @@ void cmVisualStudioGeneratorOptions::OutputPreprocessorDefinitions(
}
std::ostringstream oss;
const char* sep = "";
if (this->Version >= cmGlobalVisualStudioGenerator::VS10) {
oss << "%(" << tag << ")";
}
std::vector<std::string>::const_iterator de =
cmRemoveDuplicates(this->Defines);
for (std::string const& di : cmMakeRange(this->Defines.cbegin(), de)) {
......@@ -437,11 +439,7 @@ void cmVisualStudioGeneratorOptions::OutputPreprocessorDefinitions(
}
}
// Store the flag in the project file.
oss << sep << define;
sep = ";";
}
if (this->Version >= cmGlobalVisualStudioGenerator::VS10) {
oss << ";%(" << tag << ")";
oss << ';' << define;
}
this->OutputFlag(fout, indent, tag, oss.str());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment