summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCoreTryCompile.cxx7
-rw-r--r--Source/cmakemain.cxx11
2 files changed, 18 insertions, 0 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 8ecf264..bf18143 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -570,6 +570,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
*cmp0123 == "NEW"_s ? "NEW" : "OLD");
}
+ /* Set cache/normal variable policy to match outer project.
+ It may affect toolchain files. */
+ if (this->Makefile->GetPolicyStatus(cmPolicies::CMP0126) !=
+ cmPolicies::NEW) {
+ fprintf(fout, "cmake_policy(SET CMP0126 OLD)\n");
+ }
+
std::string projectLangs;
for (std::string const& li : testLangs) {
projectLangs += " " + li;
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 1725375..64d93df 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -153,9 +153,20 @@ std::string cmakemainGetStack(cmake* cm)
void cmakemainMessageCallback(const std::string& m,
const cmMessageMetadata& md, cmake* cm)
{
+#if defined(_WIN32)
+ // FIXME: On Windows we replace cerr's streambuf with a custom
+ // implementation that converts our internal UTF-8 encoding to the
+ // console's encoding. It also does *not* replace LF with CRLF.
+ // Since stderr does not convert encoding and does convert LF, we
+ // cannot use it to print messages. Another implementation will
+ // be needed to print colored messages on Windows.
+ static_cast<void>(md);
+ std::cerr << m << cmakemainGetStack(cm) << "\n";
+#else
cmsysTerminal_cfprintf(md.desiredColor, stderr, "%s", m.c_str());
fflush(stderr); // stderr is buffered in some cases.
std::cerr << cmakemainGetStack(cm) << "\n";
+#endif
}
void cmakemainProgressCallback(const std::string& m, float prog, cmake* cm)