From c886e312bbd6e26f049215c8bcc821d9597fed8c Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Thu, 15 Sep 2011 16:28:35 +0200 Subject: 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 --- Source/cmTryCompileCommand.cxx | 9 ++++++++- Source/cmTryRunCommand.cxx | 8 ++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx index 4d39d54..546e42f 100644 --- a/Source/cmTryCompileCommand.cxx +++ b/Source/cmTryCompileCommand.cxx @@ -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; } - diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index ce402a8..9044cf8 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -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 tryCompile; -- cgit v0.12