diff options
-rw-r--r-- | Source/cmGlobalGenerator.h | 4 | ||||
-rw-r--r-- | Source/cmGlobalJOMMakefileGenerator.cxx | 28 | ||||
-rw-r--r-- | Source/cmGlobalJOMMakefileGenerator.h | 3 | ||||
-rw-r--r-- | Source/cmGlobalNMakeMakefileGenerator.cxx | 28 | ||||
-rw-r--r-- | Source/cmGlobalNMakeMakefileGenerator.h | 3 | ||||
-rw-r--r-- | Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr-JOM.txt | 17 | ||||
-rw-r--r-- | Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr-NMake.txt | 17 | ||||
-rw-r--r-- | Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr-JOM.txt | 17 | ||||
-rw-r--r-- | Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr-NMake.txt | 17 | ||||
-rw-r--r-- | Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr-JOM.txt | 35 | ||||
-rw-r--r-- | Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr-NMake.txt | 35 | ||||
-rw-r--r-- | Tests/RunCMake/CompilerNotFound/RunCMakeTest.cmake | 14 |
12 files changed, 192 insertions, 26 deletions
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 3402fbc..ec916ae 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -374,6 +374,8 @@ protected: void SetLanguageEnabledFlag(const std::string& l, cmMakefile* mf); void SetLanguageEnabledMaps(const std::string& l, cmMakefile* mf); void FillExtensionToLanguageMap(const std::string& l, cmMakefile* mf); + virtual void PrintCompilerAdvice(std::ostream& os, std::string const& lang, + const char* envVar) const; virtual bool ComputeTargetDepends(); @@ -462,8 +464,6 @@ private: virtual void ForceLinkerLanguages(); - virtual void PrintCompilerAdvice(std::ostream& os, std::string const& lang, - const char* envVar) const; void CheckCompilerIdCompatibility(cmMakefile* mf, std::string const& lang) const; diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx index 50e7053..3f33f91 100644 --- a/Source/cmGlobalJOMMakefileGenerator.cxx +++ b/Source/cmGlobalJOMMakefileGenerator.cxx @@ -36,18 +36,6 @@ void cmGlobalJOMMakefileGenerator // pick a default mf->AddDefinition("CMAKE_GENERATOR_CC", "cl"); mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl"); - if(!(cmSystemTools::GetEnv("INCLUDE") && - cmSystemTools::GetEnv("LIB")) - ) - { - std::string message = "To use the JOM generator, cmake must be run " - "from a shell that can use the compiler cl from the command line. " - "This environment does not contain INCLUDE, LIB, or LIBPATH, and " - "these must be set for the cl compiler to work. "; - mf->IssueMessage(cmake::WARNING, - message); - } - this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); } @@ -58,3 +46,19 @@ void cmGlobalJOMMakefileGenerator entry.Name = cmGlobalJOMMakefileGenerator::GetActualName(); entry.Brief = "Generates JOM makefiles."; } + +//---------------------------------------------------------------------------- +void cmGlobalJOMMakefileGenerator::PrintCompilerAdvice(std::ostream& os, + std::string const& lang, + const char* envVar) const +{ + if(lang == "CXX" || lang == "C") + { + os << + "To use the JOM generator with Visual C++, cmake must be run from a " + "shell that can use the compiler cl from the command line. This " + "environment is unable to invoke the cl compiler. To fix this problem, " + "run cmake from the Visual Studio Command Prompt (vcvarsall.bat).\n"; + } + this->cmGlobalUnixMakefileGenerator3::PrintCompilerAdvice(os, lang, envVar); +} diff --git a/Source/cmGlobalJOMMakefileGenerator.h b/Source/cmGlobalJOMMakefileGenerator.h index 2185b23..1869fed 100644 --- a/Source/cmGlobalJOMMakefileGenerator.h +++ b/Source/cmGlobalJOMMakefileGenerator.h @@ -42,6 +42,9 @@ public: */ virtual void EnableLanguage(std::vector<std::string>const& languages, cmMakefile *, bool optional); +private: + void PrintCompilerAdvice(std::ostream& os, std::string const& lang, + const char* envVar) const; }; #endif diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx index 4219c34..7c570a6 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.cxx +++ b/Source/cmGlobalNMakeMakefileGenerator.cxx @@ -36,18 +36,6 @@ void cmGlobalNMakeMakefileGenerator // pick a default mf->AddDefinition("CMAKE_GENERATOR_CC", "cl"); mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl"); - if(!(cmSystemTools::GetEnv("INCLUDE") && - cmSystemTools::GetEnv("LIB")) - ) - { - std::string message = "To use the NMake generator, cmake must be run " - "from a shell that can use the compiler cl from the command line. " - "This environment does not contain INCLUDE, LIB, or LIBPATH, and " - "these must be set for the cl compiler to work. "; - mf->IssueMessage(cmake::WARNING, - message); - } - this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); } @@ -58,3 +46,19 @@ void cmGlobalNMakeMakefileGenerator entry.Name = cmGlobalNMakeMakefileGenerator::GetActualName(); entry.Brief = "Generates NMake makefiles."; } + +//---------------------------------------------------------------------------- +void cmGlobalNMakeMakefileGenerator::PrintCompilerAdvice(std::ostream& os, + std::string const& lang, + const char* envVar) const +{ + if(lang == "CXX" || lang == "C") + { + os << + "To use the NMake generator with Visual C++, cmake must be run from a " + "shell that can use the compiler cl from the command line. This " + "environment is unable to invoke the cl compiler. To fix this problem, " + "run cmake from the Visual Studio Command Prompt (vcvarsall.bat).\n"; + } + this->cmGlobalUnixMakefileGenerator3::PrintCompilerAdvice(os, lang, envVar); +} diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h index dd72c49..3c8375a 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.h +++ b/Source/cmGlobalNMakeMakefileGenerator.h @@ -40,6 +40,9 @@ public: */ virtual void EnableLanguage(std::vector<std::string>const& languages, cmMakefile *, bool optional); +private: + void PrintCompilerAdvice(std::ostream& os, std::string const& lang, + const char* envVar) const; }; #endif diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr-JOM.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr-JOM.txt new file mode 100644 index 0000000..b7db7eb --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr-JOM.txt @@ -0,0 +1,17 @@ +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. + + To use the JOM generator with Visual C\+\+, cmake must be run from a shell + that can use the compiler cl from the command line. This environment is + unable to invoke the cl compiler. To fix this problem, run cmake from the + Visual Studio Command Prompt \(vcvarsall.bat\). + + 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-stderr-NMake.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr-NMake.txt new file mode 100644 index 0000000..03c5933 --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr-NMake.txt @@ -0,0 +1,17 @@ +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. + + To use the NMake generator with Visual C\+\+, cmake must be run from a shell + that can use the compiler cl from the command line. This environment is + unable to invoke the cl compiler. To fix this problem, run cmake from the + Visual Studio Command Prompt \(vcvarsall.bat\). + + 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/BadCompilerCXX-stderr-JOM.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr-JOM.txt new file mode 100644 index 0000000..4b42ea6 --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr-JOM.txt @@ -0,0 +1,17 @@ +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. + + To use the JOM generator with Visual C\+\+, cmake must be run from a shell + that can use the compiler cl from the command line. This environment is + unable to invoke the cl compiler. To fix this problem, run cmake from the + Visual Studio Command Prompt \(vcvarsall.bat\). + + 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-stderr-NMake.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr-NMake.txt new file mode 100644 index 0000000..1bfcdcc --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr-NMake.txt @@ -0,0 +1,17 @@ +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. + + To use the NMake generator with Visual C\+\+, cmake must be run from a shell + that can use the compiler cl from the command line. This environment is + unable to invoke the cl compiler. To fix this problem, run cmake from the + Visual Studio Command Prompt \(vcvarsall.bat\). + + 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-stderr-JOM.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr-JOM.txt new file mode 100644 index 0000000..f25a267 --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr-JOM.txt @@ -0,0 +1,35 @@ +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. + + To use the JOM generator with Visual C\+\+, cmake must be run from a shell + that can use the compiler cl from the command line. This environment is + unable to invoke the cl compiler. To fix this problem, run cmake from the + Visual Studio Command Prompt \(vcvarsall.bat\). + + 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. + + To use the JOM generator with Visual C\+\+, cmake must be run from a shell + that can use the compiler cl from the command line. This environment is + unable to invoke the cl compiler. To fix this problem, run cmake from the + Visual Studio Command Prompt \(vcvarsall.bat\). + + 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-stderr-NMake.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr-NMake.txt new file mode 100644 index 0000000..ffcdce8 --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr-NMake.txt @@ -0,0 +1,35 @@ +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. + + To use the NMake generator with Visual C\+\+, cmake must be run from a shell + that can use the compiler cl from the command line. This environment is + unable to invoke the cl compiler. To fix this problem, run cmake from the + Visual Studio Command Prompt \(vcvarsall.bat\). + + 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. + + To use the NMake generator with Visual C\+\+, cmake must be run from a shell + that can use the compiler cl from the command line. This environment is + unable to invoke the cl compiler. To fix this problem, run cmake from the + Visual Studio Command Prompt \(vcvarsall.bat\). + + 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/RunCMakeTest.cmake b/Tests/RunCMake/CompilerNotFound/RunCMakeTest.cmake index 8b84f39..19d149c 100644 --- a/Tests/RunCMake/CompilerNotFound/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompilerNotFound/RunCMakeTest.cmake @@ -4,6 +4,20 @@ if("${RunCMake_GENERATOR}" MATCHES "Visual Studio|Xcode") run_cmake(NoCompilerC-IDE) run_cmake(NoCompilerCXX-IDE) run_cmake(NoCompilerCandCXX-IDE) +elseif(RunCMake_GENERATOR STREQUAL "NMake Makefiles") + set(RunCMake-stderr-file BadCompilerC-stderr-NMake.txt) + run_cmake(BadCompilerC) + set(RunCMake-stderr-file BadCompilerCXX-stderr-NMake.txt) + run_cmake(BadCompilerCXX) + set(RunCMake-stderr-file BadCompilerCandCXX-stderr-NMake.txt) + run_cmake(BadCompilerCandCXX) +elseif(RunCMake_GENERATOR STREQUAL "NMake Makefiles JOM") + set(RunCMake-stderr-file BadCompilerC-stderr-JOM.txt) + run_cmake(BadCompilerC) + set(RunCMake-stderr-file BadCompilerCXX-stderr-JOM.txt) + run_cmake(BadCompilerCXX) + set(RunCMake-stderr-file BadCompilerCandCXX-stderr-JOM.txt) + run_cmake(BadCompilerCandCXX) else() run_cmake(BadCompilerC) run_cmake(BadCompilerCXX) |