Browse Source

BUG: fix get make command problems.

Bill Hoffman 23 years ago
parent
commit
1e8914ada8

+ 3 - 1
Modules/CMakeUnixFindMake.cmake

@@ -1,2 +1,4 @@
-FIND_PROGRAM(CMAKE_MAKE_PROGRAM gmake make )
+MESSAGE("unix find make sdfsdf ${CMAKE_MAKE_PROGRAM}")
+FIND_PROGRAM(CMAKE_MAKE_PROGRAM NAMES gmake make )
+MESSAGE("unix find make sdfsdf ${CMAKE_MAKE_PROGRAM}")
 MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM)

+ 8 - 7
Source/cmGlobalBorlandMakefileGenerator.cxx

@@ -39,13 +39,14 @@ void cmGlobalBorlandMakefileGenerator::EnableLanguage(const char* l,
     }
   mf->AddDefinition("BORLAND", "1");
   mf->AddDefinition("CMAKE_GENERATOR_CC", "bcc32");
-  mf->AddDefinition("CMAKE_GENERATOR_CXX", "bcc32");
-  std::string setMakeProgram = mf->GetDefinition("CMAKE_ROOT");
-  setMakeProgram += "/Modules/CMakeBorlandFindMake.cmake";
-  mf->ReadListFile(0, setMakeProgram.c_str());
-  mf->AddDefinition("CMAKE_MAKE_PROGRAM", "make");
-  
-  
+  mf->AddDefinition("CMAKE_GENERATOR_CXX", "bcc32"); 
+  if(!mf->GetDefinition("CMAKE_MAKE_PROGRAM")
+     || cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM")))
+    {
+    std::string setMakeProgram = mf->GetDefinition("CMAKE_ROOT");
+    setMakeProgram += "/Modules/CMakeBorlandFindMake.cmake";
+    mf->ReadListFile(0, setMakeProgram.c_str());
+    }
   this->cmGlobalUnixMakefileGenerator::EnableLanguage(l, mf);
 }
 

+ 8 - 3
Source/cmGlobalNMakeMakefileGenerator.cxx

@@ -24,9 +24,14 @@ void cmGlobalNMakeMakefileGenerator::EnableLanguage(const char* l,
   // pick a default 
   mf->AddDefinition("CMAKE_GENERATOR_CC", "cl");
   mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl");
-  std::string setMakeProgram = mf->GetDefinition("CMAKE_ROOT");
-  setMakeProgram += "/Modules/CMakeNMakeFindMake.cmake";
-  mf->ReadListFile(0, setMakeProgram.c_str());
+  if(!mf->GetDefinition("CMAKE_MAKE_PROGRAM")
+     || cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM")))
+    {
+    std::string setMakeProgram = mf->GetDefinition("CMAKE_ROOT");
+    setMakeProgram += "/Modules/CMakeNMakeFindMake.cmake";
+    mf->ReadListFile(0, setMakeProgram.c_str());
+    }
+  
 
   this->cmGlobalUnixMakefileGenerator::EnableLanguage(l, mf);
 }

+ 9 - 2
Source/cmGlobalUnixMakefileGenerator.cxx

@@ -23,7 +23,8 @@
 void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang, 
                                                    cmMakefile *mf)
 {
-  if(!mf->GetDefinition("CMAKE_MAKE_PROGRAM"))
+  if(!mf->GetDefinition("CMAKE_MAKE_PROGRAM")
+     || cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM")))
     {
     std::string setMakeProgram = mf->GetDefinition("CMAKE_ROOT");
     setMakeProgram += "/Modules/CMakeUnixFindMake.cmake";
@@ -155,7 +156,13 @@ cmLocalGenerator *cmGlobalUnixMakefileGenerator::CreateLocalGenerator()
 
 void cmGlobalUnixMakefileGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen)
 {
-  this->SetConfiguredFilesPath(gen->GetCMakeInstance()->GetHomeOutputDirectory());
+  this->SetConfiguredFilesPath(
+    gen->GetCMakeInstance()->GetHomeOutputDirectory());
+  const char* make =
+    gen->GetCMakeInstance()->GetCacheDefinition("CMAKE_MAKE_PROGRAM");
+  this->GetCMakeInstance()->AddCacheEntry("CMAKE_MAKE_PROGRAM", make,
+                                          "make program",
+                                          cmCacheManager::FILEPATH);
   // if C,  then enable C
   if(gen->GetLanguageEnabled("C"))
     {

+ 9 - 0
Source/cmake.cxx

@@ -939,6 +939,15 @@ const char *cmake::GetReleaseVersion()
   return cmMakefile::GetReleaseVersion();
 }
 
+void cmake::AddCacheEntry(const char* key, const char* value, 
+                          const char* helpString, 
+                          int type)
+{
+  m_CacheManager->AddCacheEntry(key, value, 
+                                helpString,
+                                cmCacheManager::CacheEntryType(type));
+}
+
 const char* cmake::GetCacheDefinition(const char* name) const
 {
   return m_CacheManager->GetCacheValue(name);

+ 4 - 1
Source/cmake.h

@@ -170,7 +170,10 @@ class cmake
    * Given a variable name, return its value (as a string).
    */
   const char* GetCacheDefinition(const char*) const;
-
+  ///! Add an entry into the cache
+  void AddCacheEntry(const char* key, const char* value, 
+                     const char* helpString, 
+                     int type);
   /** 
    * Execute commands during the build process. Supports options such
    * as echo, remove file etc.