summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorJames Johnston <johnstonj.public@codenest.com>2015-08-05 21:23:07 (GMT)
committerJames Johnston <johnstonj.public@codenest.com>2015-08-06 17:32:43 (GMT)
commitafeb4eb243e01df5c7396dc346f2629b21115e2c (patch)
tree0ed8f16b6ebc6d9ad28e3fc2397821cb4c6afb7c /Source
parent22590805bffe74c3b4998152556561a2c2b6d177 (diff)
downloadCMake-afeb4eb243e01df5c7396dc346f2629b21115e2c.zip
CMake-afeb4eb243e01df5c7396dc346f2629b21115e2c.tar.gz
CMake-afeb4eb243e01df5c7396dc346f2629b21115e2c.tar.bz2
nmake/jom: Only warn about bad VS environment if compiler not found.
nmake and jom generators no longer warn about missing INCLUDE/LIB environment variables unless the C/CXX compiler cannot be found. This is useful if the user does not want to use these generators with the Visual C++ compiler, or they do not want to enable any language.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalGenerator.h4
-rw-r--r--Source/cmGlobalJOMMakefileGenerator.cxx28
-rw-r--r--Source/cmGlobalJOMMakefileGenerator.h3
-rw-r--r--Source/cmGlobalNMakeMakefileGenerator.cxx28
-rw-r--r--Source/cmGlobalNMakeMakefileGenerator.h3
5 files changed, 40 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