[Cmake-commits] CMake branch, next, updated. v2.8.12-4538-g531f196

Brad King brad.king at kitware.com
Sat Oct 26 10:33:01 EDT 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  531f1968983fd60cf6efc42d18a00a7441975e75 (commit)
       via  95c4171001e697a63721c28390dfaa885cef8327 (commit)
       via  332771c942c25c0e60de136091fe77ac761e1965 (commit)
      from  d0a470db50ce2421c33620524fd1fdd144c1a133 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=531f1968983fd60cf6efc42d18a00a7441975e75
commit 531f1968983fd60cf6efc42d18a00a7441975e75
Merge: d0a470d 95c4171
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Sat Oct 26 10:32:56 2013 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sat Oct 26 10:32:56 2013 -0400

    Merge topic 'enable-language-require-compiler' into next
    
    95c4171 Require CMAKE_<LANG>_COMPILER to be found as a full path
    332771c CMakeDetermine*Compiler: Remove temporary cache entry

diff --cc Source/cmGlobalGenerator.cxx
index bef3059,0461001..465763d
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@@ -622,8 -661,35 +661,12 @@@ cmGlobalGenerator::EnableLanguage(std::
          // next time cmake is run
          if(!mf->IsOn(compilerWorks.c_str()))
            {
+           std::string compilerLangFile = rootBin;
+           compilerLangFile += "/CMake";
+           compilerLangFile += lang;
+           compilerLangFile += "Compiler.cmake";
            cmSystemTools::RemoveFile(compilerLangFile.c_str());
            }
 -        else
 -          {
 -          // load backwards compatibility stuff for C and CXX
 -          // for old versions of CMake ListFiles C and CXX had some
 -          // backwards compatibility files they have to load
 -          // These files have a bunch of try compiles in them so
 -          // should only be done
 -          if (mf->NeedBackwardsCompatibility(1,4))
 -            {
 -            if(strcmp(lang, "C") == 0)
 -              {
 -              ifpath =
 -                mf->GetModulesFile("CMakeBackwardCompatibilityC.cmake");
 -              mf->ReadListFile(0,ifpath.c_str());
 -              }
 -            if(strcmp(lang, "CXX") == 0)
 -              {
 -              ifpath =
 -                mf->GetModulesFile("CMakeBackwardCompatibilityCXX.cmake");
 -              mf->ReadListFile(0,ifpath.c_str());
 -              }
 -            }
 -          }
          } // end if in try compile
        } // end need test language
      // Store the shared library flags so that we can satisfy CMP0018

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=95c4171001e697a63721c28390dfaa885cef8327
commit 95c4171001e697a63721c28390dfaa885cef8327
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Oct 24 13:04:24 2013 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Oct 25 10:39:34 2013 -0400

    Require CMAKE_<LANG>_COMPILER to be found as a full path
    
    All generators now support detection of the full path to the compiler, so
    require it to be so.  This will allow CMake<LANG>Information.cmake and
    other logic to assume the full path to the compiler tool is available.
    
    The Makefile generators already rejected CMAKE_<LANG>_COMPILER values
    that did not name an existing compiler.  Extend this error message to
    all generators, make it occur as early as possible, and improve the
    message with advice about how to set the compiler.  If the full path to
    the compiler is not known, finish enabling languages with a fatal error
    so configuration does not continue.
    
    For now, allow the RC language compiler to not be a full path.  Later we
    will need to detect the full path to "rc" under the VS IDE.
    
    Add a RunCMake.CompilerNotFound test to cover failure cases.
    Fix the RunCMake.CompilerChange test EmptyCompiler case to work
    when configuration does not continue past enable_language.

diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index 871cccd..d53247a 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -228,6 +228,7 @@ char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
 #endif
 
 @CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@
+ at CMAKE_C_COMPILER_ID_ERROR_FOR_TEST@
 
 /*--------------------------------------------------------------------------*/
 
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index f32fee0..b5d498d 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -221,6 +221,7 @@ char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
 #endif
 
 @CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@
+ at CMAKE_CXX_COMPILER_ID_ERROR_FOR_TEST@
 
 /*--------------------------------------------------------------------------*/
 
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index fb205be..0461001 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -138,15 +138,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang,
   if((path.size() == 0 || !cmSystemTools::FileExists(path.c_str()))
       && (optional==false))
     {
-    std::string message = "your ";
-    message += lang;
-    message += " compiler: \"";
-    message +=  name;
-    message += "\" was not found.   Please set ";
-    message += langComp;
-    message += " to a valid compiler path or name.";
-    cmSystemTools::Error(message.c_str());
-    path = name;
+    return;
     }
   std::string doc = lang;
   doc += " compiler.";
@@ -334,7 +326,7 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
 
 void
 cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
-                                  cmMakefile *mf, bool)
+                                  cmMakefile *mf, bool optional)
 {
   if(languages.size() == 0)
     {
@@ -370,6 +362,8 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
       }
     }
 
+  bool fatalError = false;
+
   mf->AddDefinition("RUN_CONFIGURE", true);
   std::string rootBin = mf->GetHomeOutputDirectory();
   rootBin += cmake::GetCMakeFilesDirectory();
@@ -556,6 +550,65 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
       this->SetLanguageEnabled("NONE", mf);
       continue;
       }
+
+    // Check that the compiler was found.
+    std::string compilerName = "CMAKE_";
+    compilerName += lang;
+    compilerName += "_COMPILER";
+    std::string compilerEnv = "CMAKE_";
+    compilerEnv += lang;
+    compilerEnv += "_COMPILER_ENV_VAR";
+    cmOStringStream noCompiler;
+    const char* compilerFile = mf->GetDefinition(compilerName.c_str());
+    if(!compilerFile || !*compilerFile ||
+       cmSystemTools::IsNOTFOUND(compilerFile))
+      {
+      noCompiler <<
+        "No " << compilerName << " could be found.\n"
+        ;
+      }
+    else if(strcmp(lang, "RC") != 0)
+      {
+      if(!cmSystemTools::FileIsFullPath(compilerFile))
+        {
+        noCompiler <<
+          "The " << compilerName << ":\n"
+          "  " << compilerFile << "\n"
+          "is not a full path and was not found in the PATH.\n"
+          ;
+        }
+      else if(!cmSystemTools::FileExists(compilerFile))
+        {
+        noCompiler <<
+          "The " << compilerName << ":\n"
+          "  " << compilerFile << "\n"
+          "is not a full path to an existing compiler tool.\n"
+          ;
+        }
+      }
+    if(!noCompiler.str().empty())
+      {
+      // Skip testing this language since the compiler is not found.
+      needTestLanguage[lang] = false;
+      if(!optional)
+        {
+        // The compiler was not found and it is not optional.  Remove
+        // CMake(LANG)Compiler.cmake so we try again next time CMake runs.
+        std::string compilerLangFile = rootBin;
+        compilerLangFile += "/CMake";
+        compilerLangFile += lang;
+        compilerLangFile += "Compiler.cmake";
+        cmSystemTools::RemoveFile(compilerLangFile.c_str());
+        if(!this->CMakeInstance->GetIsInTryCompile())
+          {
+          this->PrintCompilerAdvice(noCompiler, lang,
+                                    mf->GetDefinition(compilerEnv.c_str()));
+          mf->IssueMessage(cmake::FATAL_ERROR, noCompiler.str());
+          fatalError = true;
+          }
+        }
+      }
+
     std::string langLoadedVar = "CMAKE_";
     langLoadedVar += lang;
     langLoadedVar += "_INFORMATION_LOADED";
@@ -582,26 +635,12 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
       }
     this->LanguagesReady.insert(lang);
 
-    std::string compilerName = "CMAKE_";
-    compilerName += lang;
-    compilerName += "_COMPILER";
-    std::string compilerLangFile = rootBin;
-    compilerLangFile += "/CMake";
-    compilerLangFile += lang;
-    compilerLangFile += "Compiler.cmake";
     // Test the compiler for the language just setup
     // (but only if a compiler has been actually found)
     // At this point we should have enough info for a try compile
     // which is used in the backward stuff
     // If the language is untested then test it now with a try compile.
-    if (!mf->IsSet(compilerName.c_str()))
-      {
-      // if the compiler did not work, then remove the
-      // CMake(LANG)Compiler.cmake file so that it will get tested the
-      // next time cmake is run
-      cmSystemTools::RemoveFile(compilerLangFile.c_str());
-      }
-    else if(needTestLanguage[lang])
+    if(needTestLanguage[lang])
       {
       if (!this->CMakeInstance->GetIsInTryCompile())
         {
@@ -622,6 +661,10 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
         // next time cmake is run
         if(!mf->IsOn(compilerWorks.c_str()))
           {
+          std::string compilerLangFile = rootBin;
+          compilerLangFile += "/CMake";
+          compilerLangFile += lang;
+          compilerLangFile += "Compiler.cmake";
           cmSystemTools::RemoveFile(compilerLangFile.c_str());
           }
         else
@@ -675,6 +718,33 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
     {
     mf->ReadListFile(0,projectCompatibility.c_str());
     }
+
+  if(fatalError)
+    {
+    cmSystemTools::SetFatalErrorOccured();
+    }
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalGenerator::PrintCompilerAdvice(std::ostream& os,
+                                            std::string lang,
+                                            const char* envVar)
+{
+  // Subclasses override this method if they do not support this advice.
+  os <<
+    "Tell CMake where to find the compiler by setting "
+    ;
+  if(envVar)
+    {
+    os <<
+      "either the environment variable \"" << envVar << "\" or "
+      ;
+    }
+  os <<
+    "the CMake cache entry CMAKE_" << lang << "_COMPILER "
+    "to the full path to the compiler, or to the compiler name "
+    "if it is in the PATH."
+    ;
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index c930b2b..3c4ddb2 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -392,6 +392,8 @@ private:
   void WriteSummary();
   void WriteSummary(cmTarget* target);
 
+  virtual void PrintCompilerAdvice(std::ostream& os, std::string lang,
+                                   const char* envVar);
   void CheckCompilerIdCompatibility(cmMakefile* mf, std::string lang);
 
   cmExternalMakefileProjectGenerator* ExtraGenerator;
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index b665158..ce03a0e 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -107,6 +107,7 @@ protected:
   const char* AdditionalPlatformDefinition;
 
 private:
+  void PrintCompilerAdvice(std::ostream&, std::string, const char*) {}
   void ComputeTargetObjects(cmGeneratorTarget* gt) const;
 
   void FollowLinkDepends(cmTarget* target, std::set<cmTarget*>& linked);
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index c053943..97072b2 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -210,6 +210,7 @@ protected:
   std::vector<cmXCodeObject*> XCodeObjects;
   cmXCodeObject* RootObject;
 private:
+  void PrintCompilerAdvice(std::ostream&, std::string, const char*) {}
   void ComputeTargetObjects(cmGeneratorTarget* gt) const;
 
   std::string GetObjectsNormalDirectory(
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 8148cb6..4752798 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -60,6 +60,7 @@ add_RunCMake_test(CTest)
 if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles")
   add_RunCMake_test(CompilerChange)
 endif()
+add_RunCMake_test(CompilerNotFound)
 add_RunCMake_test(Configure)
 add_RunCMake_test(DisallowedCommands)
 add_RunCMake_test(ExternalData)
diff --git a/Tests/RunCMake/CompilerChange/EmptyCompiler.cmake b/Tests/RunCMake/CompilerChange/EmptyCompiler-override.cmake
similarity index 89%
copy from Tests/RunCMake/CompilerChange/EmptyCompiler.cmake
copy to Tests/RunCMake/CompilerChange/EmptyCompiler-override.cmake
index c87ec49..28d29e0 100644
--- a/Tests/RunCMake/CompilerChange/EmptyCompiler.cmake
+++ b/Tests/RunCMake/CompilerChange/EmptyCompiler-override.cmake
@@ -1,3 +1,2 @@
-enable_language(C)
 message(STATUS "CMAKE_C_COMPILER is \"${CMAKE_C_COMPILER}\"")
 file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cc.cmake" "set(CMAKE_C_COMPILER \"${CMAKE_C_COMPILER}\")\n")
diff --git a/Tests/RunCMake/CompilerChange/EmptyCompiler-stderr.txt b/Tests/RunCMake/CompilerChange/EmptyCompiler-stderr.txt
index 4745b25..cf3b1b3 100644
--- a/Tests/RunCMake/CompilerChange/EmptyCompiler-stderr.txt
+++ b/Tests/RunCMake/CompilerChange/EmptyCompiler-stderr.txt
@@ -1,5 +1,13 @@
 You have changed variables that require your cache to be deleted.
 Configure will be re-run and you may have to reset some variables.
 The following variables have changed:
-CMAKE_C_COMPILER= *(
-|$)
+CMAKE_C_COMPILER= *
++
+CMake Error at EmptyCompiler.cmake:2 \(enable_language\):
+  No CMAKE_C_COMPILER could be found.
+
+  Tell CMake where to find the compiler by setting either the environment
+  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
+  the compiler, or to the compiler name if it is in the PATH.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:6 \(include\)$
diff --git a/Tests/RunCMake/CompilerChange/EmptyCompiler.cmake b/Tests/RunCMake/CompilerChange/EmptyCompiler.cmake
index c87ec49..06e9e03 100644
--- a/Tests/RunCMake/CompilerChange/EmptyCompiler.cmake
+++ b/Tests/RunCMake/CompilerChange/EmptyCompiler.cmake
@@ -1,3 +1,2 @@
+set(CMAKE_USER_MAKE_RULES_OVERRIDE_C ${CMAKE_CURRENT_LIST_DIR}/EmptyCompiler-override.cmake)
 enable_language(C)
-message(STATUS "CMAKE_C_COMPILER is \"${CMAKE_C_COMPILER}\"")
-file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cc.cmake" "set(CMAKE_C_COMPILER \"${CMAKE_C_COMPILER}\")\n")
diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerC-result.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerC-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CompilerNotFound/BadCompilerC-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr.txt
new file mode 100644
index 0000000..c98842d
--- /dev/null
+++ b/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr.txt
@@ -0,0 +1,12 @@
+CMake Error at BadCompilerC.cmake:2 \(enable_language\):
+  The CMAKE_C_COMPILER:
+
+    no-C-compiler
+
+  is not a full path and was not found in the PATH.
+
+  Tell CMake where to find the compiler by setting either the environment
+  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
+  the compiler, or to the compiler name if it is in the PATH.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerC.cmake b/Tests/RunCMake/CompilerNotFound/BadCompilerC.cmake
new file mode 100644
index 0000000..10fe59a
--- /dev/null
+++ b/Tests/RunCMake/CompilerNotFound/BadCompilerC.cmake
@@ -0,0 +1,3 @@
+set(CMAKE_C_COMPILER "no-C-compiler")
+enable_language(C)
+message(FATAL_ERROR "This error should not be reached.")
diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-result.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr.txt
new file mode 100644
index 0000000..7ef4f5e
--- /dev/null
+++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr.txt
@@ -0,0 +1,12 @@
+CMake Error at BadCompilerCXX.cmake:2 \(enable_language\):
+  The CMAKE_CXX_COMPILER:
+
+    no-CXX-compiler
+
+  is not a full path and was not found in the PATH.
+
+  Tell CMake where to find the compiler by setting either the environment
+  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
+  to the compiler, or to the compiler name if it is in the PATH.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerCXX.cmake b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX.cmake
new file mode 100644
index 0000000..3b1e890
--- /dev/null
+++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX.cmake
@@ -0,0 +1,3 @@
+set(CMAKE_CXX_COMPILER "no-CXX-compiler")
+enable_language(CXX)
+message(FATAL_ERROR "This error should not be reached.")
diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-result.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr.txt
new file mode 100644
index 0000000..eecff54
--- /dev/null
+++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr.txt
@@ -0,0 +1,25 @@
+CMake Error at BadCompilerCandCXX.cmake:3 \(project\):
+  The CMAKE_C_COMPILER:
+
+    no-C-compiler
+
+  is not a full path and was not found in the PATH.
+
+  Tell CMake where to find the compiler by setting either the environment
+  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
+  the compiler, or to the compiler name if it is in the PATH.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
++
+CMake Error at BadCompilerCandCXX.cmake:3 \(project\):
+  The CMAKE_CXX_COMPILER:
+
+    no-CXX-compiler
+
+  is not a full path and was not found in the PATH.
+
+  Tell CMake where to find the compiler by setting either the environment
+  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
+  to the compiler, or to the compiler name if it is in the PATH.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX.cmake b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX.cmake
new file mode 100644
index 0000000..2b6fa61
--- /dev/null
+++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX.cmake
@@ -0,0 +1,4 @@
+set(CMAKE_C_COMPILER "no-C-compiler")
+set(CMAKE_CXX_COMPILER "no-CXX-compiler")
+project(BadCompilerCandCXXInner C CXX)
+message(FATAL_ERROR "This error should not be reached.")
diff --git a/Tests/RunCMake/CompilerNotFound/CMakeLists.txt b/Tests/RunCMake/CompilerNotFound/CMakeLists.txt
new file mode 100644
index 0000000..12cd3c7
--- /dev/null
+++ b/Tests/RunCMake/CompilerNotFound/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8.4)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CompilerNotFound/NoCompilerC-IDE-result.txt b/Tests/RunCMake/CompilerNotFound/NoCompilerC-IDE-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CompilerNotFound/NoCompilerC-IDE-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CompilerNotFound/NoCompilerC-IDE-stderr.txt b/Tests/RunCMake/CompilerNotFound/NoCompilerC-IDE-stderr.txt
new file mode 100644
index 0000000..88bb95e
--- /dev/null
+++ b/Tests/RunCMake/CompilerNotFound/NoCompilerC-IDE-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at NoCompilerC-IDE.cmake:2 \(enable_language\):
+  No CMAKE_C_COMPILER could be found.
+
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/CompilerNotFound/NoCompilerC-IDE.cmake b/Tests/RunCMake/CompilerNotFound/NoCompilerC-IDE.cmake
new file mode 100644
index 0000000..45e1a68
--- /dev/null
+++ b/Tests/RunCMake/CompilerNotFound/NoCompilerC-IDE.cmake
@@ -0,0 +1,3 @@
+set(CMAKE_C_COMPILER_ID_ERROR_FOR_TEST "#error NoCompilerC-IDE")
+enable_language(C)
+message(FATAL_ERROR "This error should not be reached.")
diff --git a/Tests/RunCMake/CompilerNotFound/NoCompilerCXX-IDE-result.txt b/Tests/RunCMake/CompilerNotFound/NoCompilerCXX-IDE-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CompilerNotFound/NoCompilerCXX-IDE-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CompilerNotFound/NoCompilerCXX-IDE-stderr.txt b/Tests/RunCMake/CompilerNotFound/NoCompilerCXX-IDE-stderr.txt
new file mode 100644
index 0000000..4c92323
--- /dev/null
+++ b/Tests/RunCMake/CompilerNotFound/NoCompilerCXX-IDE-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at NoCompilerCXX-IDE.cmake:2 \(enable_language\):
+  No CMAKE_CXX_COMPILER could be found.
+
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/CompilerNotFound/NoCompilerCXX-IDE.cmake b/Tests/RunCMake/CompilerNotFound/NoCompilerCXX-IDE.cmake
new file mode 100644
index 0000000..85025a0
--- /dev/null
+++ b/Tests/RunCMake/CompilerNotFound/NoCompilerCXX-IDE.cmake
@@ -0,0 +1,3 @@
+set(CMAKE_CXX_COMPILER_ID_ERROR_FOR_TEST "#error NoCompilerCXX-IDE")
+enable_language(CXX)
+message(FATAL_ERROR "This error should not be reached.")
diff --git a/Tests/RunCMake/CompilerNotFound/NoCompilerCandCXX-IDE-result.txt b/Tests/RunCMake/CompilerNotFound/NoCompilerCandCXX-IDE-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CompilerNotFound/NoCompilerCandCXX-IDE-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CompilerNotFound/NoCompilerCandCXX-IDE-stderr.txt b/Tests/RunCMake/CompilerNotFound/NoCompilerCandCXX-IDE-stderr.txt
new file mode 100644
index 0000000..21c69f5
--- /dev/null
+++ b/Tests/RunCMake/CompilerNotFound/NoCompilerCandCXX-IDE-stderr.txt
@@ -0,0 +1,11 @@
+CMake Error at NoCompilerCandCXX-IDE.cmake:3 \(project\):
+  No CMAKE_C_COMPILER could be found.
+
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
++
+CMake Error at NoCompilerCandCXX-IDE.cmake:3 \(project\):
+  No CMAKE_CXX_COMPILER could be found.
+
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/CompilerNotFound/NoCompilerCandCXX-IDE.cmake b/Tests/RunCMake/CompilerNotFound/NoCompilerCandCXX-IDE.cmake
new file mode 100644
index 0000000..78256a9
--- /dev/null
+++ b/Tests/RunCMake/CompilerNotFound/NoCompilerCandCXX-IDE.cmake
@@ -0,0 +1,4 @@
+set(CMAKE_C_COMPILER_ID_ERROR_FOR_TEST "#error NoCompilerCandCXX-IDE")
+set(CMAKE_CXX_COMPILER_ID_ERROR_FOR_TEST "#error NoCompilerCandCXX-IDE")
+project(NoCompilerCandCXXInner C CXX)
+message(FATAL_ERROR "This error should not be reached.")
diff --git a/Tests/RunCMake/CompilerNotFound/RunCMakeTest.cmake b/Tests/RunCMake/CompilerNotFound/RunCMakeTest.cmake
new file mode 100644
index 0000000..8b84f39
--- /dev/null
+++ b/Tests/RunCMake/CompilerNotFound/RunCMakeTest.cmake
@@ -0,0 +1,11 @@
+include(RunCMake)
+
+if("${RunCMake_GENERATOR}" MATCHES "Visual Studio|Xcode")
+  run_cmake(NoCompilerC-IDE)
+  run_cmake(NoCompilerCXX-IDE)
+  run_cmake(NoCompilerCandCXX-IDE)
+else()
+  run_cmake(BadCompilerC)
+  run_cmake(BadCompilerCXX)
+  run_cmake(BadCompilerCandCXX)
+endif()

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=332771c942c25c0e60de136091fe77ac761e1965
commit 332771c942c25c0e60de136091fe77ac761e1965
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Oct 24 11:31:58 2013 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Oct 24 11:34:07 2013 -0400

    CMakeDetermine*Compiler: Remove temporary cache entry
    
    When the user or toolchain file sets CMAKE_<LANG>_COMPILER to a name
    without a path we use find_program with CMAKE_<LANG>_COMPILER_WITH_PATH
    to search for the tool.  Remove the temporary cache entry afterward to
    avoid exposing it to projects.  It is not set by other logic paths so no
    one should be using it.

diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake
index 0fecb5d..1adfadb 100644
--- a/Modules/CMakeDetermineASMCompiler.cmake
+++ b/Modules/CMakeDetermineASMCompiler.cmake
@@ -59,10 +59,10 @@ else()
   get_filename_component(_CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" PATH)
   if(NOT _CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH)
     find_program(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER})
-    mark_as_advanced(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH)
     if(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH)
       set(CMAKE_ASM${ASM_DIALECT}_COMPILER ${CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH} CACHE FILEPATH "Assembler" FORCE)
     endif()
+    unset(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH CACHE)
   endif()
 endif()
 mark_as_advanced(CMAKE_ASM${ASM_DIALECT}_COMPILER)
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index 8769c66..9807677 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -92,10 +92,10 @@ else()
     get_filename_component(_CMAKE_USER_C_COMPILER_PATH "${CMAKE_C_COMPILER}" PATH)
     if(NOT _CMAKE_USER_C_COMPILER_PATH)
       find_program(CMAKE_C_COMPILER_WITH_PATH NAMES ${CMAKE_C_COMPILER})
-      mark_as_advanced(CMAKE_C_COMPILER_WITH_PATH)
       if(CMAKE_C_COMPILER_WITH_PATH)
         set(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_WITH_PATH} CACHE STRING "C compiler" FORCE)
       endif()
+      unset(CMAKE_C_COMPILER_WITH_PATH CACHE)
     endif()
   endif()
   mark_as_advanced(CMAKE_C_COMPILER)
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index c79ba89..0a4624c 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -91,10 +91,10 @@ else()
     get_filename_component(_CMAKE_USER_CXX_COMPILER_PATH "${CMAKE_CXX_COMPILER}" PATH)
     if(NOT _CMAKE_USER_CXX_COMPILER_PATH)
       find_program(CMAKE_CXX_COMPILER_WITH_PATH NAMES ${CMAKE_CXX_COMPILER})
-      mark_as_advanced(CMAKE_CXX_COMPILER_WITH_PATH)
       if(CMAKE_CXX_COMPILER_WITH_PATH)
         set(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_WITH_PATH} CACHE STRING "CXX compiler" FORCE)
       endif()
+      unset(CMAKE_CXX_COMPILER_WITH_PATH CACHE)
     endif()
   endif()
   mark_as_advanced(CMAKE_CXX_COMPILER)
diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
index 13cfb00..10574b1 100644
--- a/Modules/CMakeDetermineFortranCompiler.cmake
+++ b/Modules/CMakeDetermineFortranCompiler.cmake
@@ -109,11 +109,11 @@ else()
     get_filename_component(_CMAKE_USER_Fortran_COMPILER_PATH "${CMAKE_Fortran_COMPILER}" PATH)
     if(NOT _CMAKE_USER_Fortran_COMPILER_PATH)
       find_program(CMAKE_Fortran_COMPILER_WITH_PATH NAMES ${CMAKE_Fortran_COMPILER})
-      mark_as_advanced(CMAKE_Fortran_COMPILER_WITH_PATH)
       if(CMAKE_Fortran_COMPILER_WITH_PATH)
         set(CMAKE_Fortran_COMPILER ${CMAKE_Fortran_COMPILER_WITH_PATH}
           CACHE STRING "Fortran compiler" FORCE)
       endif()
+      unset(CMAKE_Fortran_COMPILER_WITH_PATH CACHE)
     endif()
   endif()
   mark_as_advanced(CMAKE_Fortran_COMPILER)

-----------------------------------------------------------------------

Summary of changes:
 Modules/CMakeCCompilerId.c.in                      |    1 +
 Modules/CMakeCXXCompilerId.cpp.in                  |    1 +
 Modules/CMakeDetermineASMCompiler.cmake            |    2 +-
 Modules/CMakeDetermineCCompiler.cmake              |    2 +-
 Modules/CMakeDetermineCXXCompiler.cmake            |    2 +-
 Modules/CMakeDetermineFortranCompiler.cmake        |    2 +-
 Source/cmGlobalGenerator.cxx                       |  120 ++++++++++++++++----
 Source/cmGlobalGenerator.h                         |    2 +
 Source/cmGlobalVisualStudioGenerator.h             |    1 +
 Source/cmGlobalXCodeGenerator.h                    |    1 +
 Tests/RunCMake/CMakeLists.txt                      |    1 +
 .../CompilerChange/EmptyCompiler-override.cmake    |    2 +
 .../CompilerChange/EmptyCompiler-stderr.txt        |   12 ++-
 Tests/RunCMake/CompilerChange/EmptyCompiler.cmake  |    3 +-
 .../BadCompilerC-result.txt}                       |    0
 .../CompilerNotFound/BadCompilerC-stderr.txt       |   12 ++
 Tests/RunCMake/CompilerNotFound/BadCompilerC.cmake |    3 +
 .../BadCompilerCXX-result.txt}                     |    0
 .../CompilerNotFound/BadCompilerCXX-stderr.txt     |   12 ++
 .../RunCMake/CompilerNotFound/BadCompilerCXX.cmake |    3 +
 .../BadCompilerCandCXX-result.txt}                 |    0
 .../CompilerNotFound/BadCompilerCandCXX-stderr.txt |   25 ++++
 .../CompilerNotFound/BadCompilerCandCXX.cmake      |    4 +
 .../{CMP0004 => CompilerNotFound}/CMakeLists.txt   |    0
 .../NoCompilerC-IDE-result.txt}                    |    0
 .../CompilerNotFound/NoCompilerC-IDE-stderr.txt    |    5 +
 .../CompilerNotFound/NoCompilerC-IDE.cmake         |    3 +
 .../NoCompilerCXX-IDE-result.txt}                  |    0
 .../CompilerNotFound/NoCompilerCXX-IDE-stderr.txt  |    5 +
 .../CompilerNotFound/NoCompilerCXX-IDE.cmake       |    3 +
 .../NoCompilerCandCXX-IDE-result.txt}              |    0
 .../NoCompilerCandCXX-IDE-stderr.txt               |   11 ++
 .../CompilerNotFound/NoCompilerCandCXX-IDE.cmake   |    4 +
 Tests/RunCMake/CompilerNotFound/RunCMakeTest.cmake |   11 ++
 34 files changed, 220 insertions(+), 33 deletions(-)
 create mode 100644 Tests/RunCMake/CompilerChange/EmptyCompiler-override.cmake
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => CompilerNotFound/BadCompilerC-result.txt} (100%)
 create mode 100644 Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr.txt
 create mode 100644 Tests/RunCMake/CompilerNotFound/BadCompilerC.cmake
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => CompilerNotFound/BadCompilerCXX-result.txt} (100%)
 create mode 100644 Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr.txt
 create mode 100644 Tests/RunCMake/CompilerNotFound/BadCompilerCXX.cmake
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => CompilerNotFound/BadCompilerCandCXX-result.txt} (100%)
 create mode 100644 Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr.txt
 create mode 100644 Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX.cmake
 copy Tests/RunCMake/{CMP0004 => CompilerNotFound}/CMakeLists.txt (100%)
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => CompilerNotFound/NoCompilerC-IDE-result.txt} (100%)
 create mode 100644 Tests/RunCMake/CompilerNotFound/NoCompilerC-IDE-stderr.txt
 create mode 100644 Tests/RunCMake/CompilerNotFound/NoCompilerC-IDE.cmake
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => CompilerNotFound/NoCompilerCXX-IDE-result.txt} (100%)
 create mode 100644 Tests/RunCMake/CompilerNotFound/NoCompilerCXX-IDE-stderr.txt
 create mode 100644 Tests/RunCMake/CompilerNotFound/NoCompilerCXX-IDE.cmake
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => CompilerNotFound/NoCompilerCandCXX-IDE-result.txt} (100%)
 create mode 100644 Tests/RunCMake/CompilerNotFound/NoCompilerCandCXX-IDE-stderr.txt
 create mode 100644 Tests/RunCMake/CompilerNotFound/NoCompilerCandCXX-IDE.cmake
 create mode 100644 Tests/RunCMake/CompilerNotFound/RunCMakeTest.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list