Improve behaviour of --find-package mode with try_run/try_compile

Instead of failing with an error message which says things have not been
setup correctly, it now says that try_compile/try_run() are not
supported in find_package mode (#12426).

Alex
This commit is contained in:
Alex Neundorf 2011-09-15 16:28:35 +02:00
parent 31f43fdb5a
commit c886e312bb
2 changed files with 16 additions and 1 deletions

View File

@ -20,6 +20,14 @@ bool cmTryCompileCommand
return false;
}
if(this->Makefile->GetCMakeInstance()->GetWorkingMode() ==
cmake::FIND_PACKAGE_MODE)
{
cmSystemTools::Error(
"The TRY_COMPILE() command is not supported in --find-package mode.");
return false;
}
this->TryCompileCode(argv);
// if They specified clean then we clean up what we can
@ -32,4 +40,3 @@ bool cmTryCompileCommand
}
return true;
}

View File

@ -22,6 +22,14 @@ bool cmTryRunCommand
return false;
}
if(this->Makefile->GetCMakeInstance()->GetWorkingMode() ==
cmake::FIND_PACKAGE_MODE)
{
cmSystemTools::Error(
"The TRY_RUN() command is not supported in --find-package mode.");
return false;
}
// build an arg list for TryCompile and extract the runArgs,
std::vector<std::string> tryCompile;