Honor CMAKE_USER_MAKE_RULES_OVERRIDE in try_compile (#10902)

This commit is contained in:
David Genest 2010-06-29 08:28:47 -04:00 committed by Brad King
parent a55aee5cdd
commit 295b5b60df
1 changed files with 17 additions and 0 deletions

View File

@ -175,6 +175,23 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
{ {
fprintf(fout, "SET(CMAKE_MODULE_PATH %s)\n", def); fprintf(fout, "SET(CMAKE_MODULE_PATH %s)\n", def);
} }
const char* rulesOverrideBase = "CMAKE_USER_MAKE_RULES_OVERRIDE";
std::string rulesOverrideLang =
rulesOverrideBase + (lang ? std::string("_") + lang : "");
if(const char* rulesOverridePath =
this->Makefile->GetDefinition(rulesOverrideLang.c_str()))
{
fprintf(fout, "SET(%s \"%s\")\n",
rulesOverrideLang.c_str(), rulesOverridePath);
}
else if(const char* rulesOverridePath2 =
this->Makefile->GetDefinition(rulesOverrideBase))
{
fprintf(fout, "SET(%s \"%s\")\n",
rulesOverrideBase, rulesOverridePath2);
}
if(lang) if(lang)
{ {
fprintf(fout, "PROJECT(CMAKE_TRY_COMPILE %s)\n", lang); fprintf(fout, "PROJECT(CMAKE_TRY_COMPILE %s)\n", lang);