diff options
author | Cristian Adam <cristian.adam@gmail.com> | 2019-10-05 10:20:37 (GMT) |
---|---|---|
committer | Cristian Adam <cristian.adam@gmail.com> | 2019-10-09 11:50:25 (GMT) |
commit | 36ded610af1bf80304a35491eeb66c34c8e9b7a8 (patch) | |
tree | d41161cbbaafe3ecbe04aefffdc40e9e5adc6fae /Source/cmFileAPICodemodel.cxx | |
parent | f1fb63b306ad06a8931ca5a00a2b9ce9e66bc12e (diff) | |
download | CMake-36ded610af1bf80304a35491eeb66c34c8e9b7a8.zip CMake-36ded610af1bf80304a35491eeb66c34c8e9b7a8.tar.gz CMake-36ded610af1bf80304a35491eeb66c34c8e9b7a8.tar.bz2 |
PCH: Generate sources during Compute step
Diffstat (limited to 'Source/cmFileAPICodemodel.cxx')
-rw-r--r-- | Source/cmFileAPICodemodel.cxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx index eb50813..48561de 100644 --- a/Source/cmFileAPICodemodel.cxx +++ b/Source/cmFileAPICodemodel.cxx @@ -869,6 +869,32 @@ CompileData Target::BuildCompileData(cmSourceFile* sf) fd.Flags.emplace_back(this->ToJBT(opt)); } + // Add precompile headers compile options. + const std::string pchSource = + this->GT->GetPchSource(this->Config, fd.Language); + + if (!pchSource.empty() && !sf->GetProperty("SKIP_PRECOMPILE_HEADERS")) { + std::string pchOptions; + if (sf->GetFullPath() == pchSource) { + pchOptions = + this->GT->GetPchCreateCompileOptions(this->Config, fd.Language); + } else { + pchOptions = + this->GT->GetPchUseCompileOptions(this->Config, fd.Language); + } + + BT<std::string> tmpOpt(pchOptions); + tmpOpt.Value = genexInterpreter.Evaluate(tmpOpt.Value, COMPILE_OPTIONS); + + // After generator evaluation we need to use the AppendCompileOptions + // method so we handle situations where backtrace entries have lists + // and properly escape flags. + std::string tmp; + lg->AppendCompileOptions(tmp, tmpOpt.Value); + BT<std::string> opt(tmp, tmpOpt.Backtrace); + fd.Flags.emplace_back(this->ToJBT(opt)); + } + // Add include directories from source file properties. { const std::string INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES"); |