summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2002-12-20 16:20:49 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2002-12-20 16:20:49 (GMT)
commitaf1c727a1fb188365a5ad285f47a37db401e85d5 (patch)
treebce4544e0bafdca247b86d8f9dcac7985652c6d3
parentbd2739feece66383f2477eb03f4d6d3fbdfb9d1e (diff)
downloadCMake-af1c727a1fb188365a5ad285f47a37db401e85d5.zip
CMake-af1c727a1fb188365a5ad285f47a37db401e85d5.tar.gz
CMake-af1c727a1fb188365a5ad285f47a37db401e85d5.tar.bz2
ENH: add a check to make sure cmake can find the c or C++ compiler for trycompile
-rw-r--r--Source/cmGlobalUnixMakefileGenerator.cxx37
1 files changed, 37 insertions, 0 deletions
diff --git a/Source/cmGlobalUnixMakefileGenerator.cxx b/Source/cmGlobalUnixMakefileGenerator.cxx
index 35bf3bf..823d742 100644
--- a/Source/cmGlobalUnixMakefileGenerator.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator.cxx
@@ -30,6 +30,43 @@ void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
{
mf->AddDefinition("CMAKE_CFG_INTDIR",".");
this->cmGlobalGenerator::EnableLanguage(lang, mf);
+ if(!lang)
+ {
+ lang = "CXX";
+ }
+ if(lang[0] == 'C')
+ {
+ if(!mf->GetDefinition("CMAKE_C_COMPILER"))
+ {
+ cmSystemTools::Error("CMAKE_C_COMPILER not set, after EnableLanguage");
+ return;
+ }
+ std::string path = cmSystemTools::FindProgram(mf->GetDefinition("CMAKE_C_COMPILER"));
+ if(path.size() == 0)
+ {
+ std::string message = "your C compiler: ";
+ message += mf->GetDefinition("CMAKE_C_COMPILER");
+ message += " was not found in your path. "
+ "For CMake to correctly use try compile commands, the compiler must "
+ "be in your path. Please add the compiler to your PATH environment,"
+ " and re-run CMake.";
+ cmSystemTools::Error(message.c_str());
+ }
+ if(strcmp(lang, "CXX") == 0)
+ {
+ path = cmSystemTools::FindProgram(mf->GetDefinition("CMAKE_CXX_COMPILER"));
+ if(path.size() == 0)
+ {
+ std::string message = "your C++ compiler: ";
+ message += mf->GetDefinition("CMAKE_CXX_COMPILER");
+ message += " was not found in your path. "
+ "For CMake to correctly use try compile commands, the compiler must "
+ "be in your path. Please add the compiler to your PATH environment,"
+ " and re-run CMake.";
+ cmSystemTools::Error(message.c_str());
+ }
+ }
+ }
}
///! Create a local generator appropriate to this Global Generator