summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2004-08-26 18:55:55 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2004-08-26 18:55:55 (GMT)
commit66a08c10e5bd4b8eff58837cd58372a4dfdd19df (patch)
tree9d094b67d0899a3cebdfeba8b0280d374e7f25db /Source
parent7cdf5c4601ea2a791d35fafadd890508ce434c6f (diff)
downloadCMake-66a08c10e5bd4b8eff58837cd58372a4dfdd19df.zip
CMake-66a08c10e5bd4b8eff58837cd58372a4dfdd19df.tar.gz
CMake-66a08c10e5bd4b8eff58837cd58372a4dfdd19df.tar.bz2
ENH: more uniform approach to enable language, one step closer to being able to enable a language without modifing cmake source code
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt3
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.cxx7
-rw-r--r--Source/cmGlobalGenerator.cxx290
-rw-r--r--Source/cmGlobalGenerator.h3
-rw-r--r--Source/cmGlobalUnixMakefileGenerator.cxx47
-rw-r--r--Source/cmListFileCache.cxx1
-rw-r--r--Source/cmLocalUnixMakefileGenerator.cxx56
-rw-r--r--Source/cmProjectCommand.cxx4
-rw-r--r--Source/cmTryCompileCommand.cxx6
-rw-r--r--Source/cmake.cxx14
10 files changed, 210 insertions, 221 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 4f59aed..1a1fea0 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -119,6 +119,9 @@ TARGET_LINK_LIBRARIES(cmake CMakeLib)
TARGET_LINK_LIBRARIES(DumpDocumentation CMakeLib)
IF(CMAKE_BUILD_WITH_CURL)
+ # Don't even look for this as we don't use that part of curl
+ # and linking in the the library can cause problems.
+ SET(HAVE_LIBCRYPTO 0)
SUBDIRS(CTest)
SET(CMTEST_SRCS ${CMTEST_SRCS} CTest/cmCTestSubmit.cxx)
ADD_DEFINITIONS(-DHAVE_CURL)
diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx
index ca99c92..0fd068d 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.cxx
+++ b/Source/cmGlobalBorlandMakefileGenerator.cxx
@@ -27,13 +27,6 @@ cmGlobalBorlandMakefileGenerator::cmGlobalBorlandMakefileGenerator()
void cmGlobalBorlandMakefileGenerator::EnableLanguage(const char* l,
cmMakefile *mf)
{
- // now load the settings
- if(!mf->GetDefinition("CMAKE_ROOT"))
- {
- cmSystemTools::Error(
- "CMAKE_ROOT has not been defined, bad GUI or driver program");
- return;
- }
std::string outdir = m_CMakeInstance->GetStartOutputDirectory();
mf->AddDefinition("BORLAND", "1");
mf->AddDefinition("CMAKE_GENERATOR_CC", "bcc32");
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index d33694b..1b416be 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -43,9 +43,8 @@ cmGlobalGenerator::~cmGlobalGenerator()
m_LocalGenerators.clear();
}
-
-void cmGlobalGenerator::EnableLanguage(const char* lang,
- cmMakefile *mf)
+// Find the make program for the generator, required for try compiles
+void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
{
if(m_FindMakeProgramFile.size() == 0)
{
@@ -53,14 +52,14 @@ void cmGlobalGenerator::EnableLanguage(const char* lang,
"Generator implementation error, "
"all generators must specify m_FindMakeProgramFile");
}
- std::string root = mf->GetRequiredDefinition("CMAKE_ROOT");
if(!mf->GetDefinition("CMAKE_MAKE_PROGRAM")
|| cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM")))
{
- std::string setMakeProgram = root;
- setMakeProgram += "/Modules/";
- setMakeProgram += m_FindMakeProgramFile;
- mf->ReadListFile(0, setMakeProgram.c_str());
+ std::string setMakeProgram = mf->GetModulesFile(m_FindMakeProgramFile.c_str());
+ if(setMakeProgram.size())
+ {
+ mf->ReadListFile(0, setMakeProgram.c_str());
+ }
}
if(!mf->GetDefinition("CMAKE_MAKE_PROGRAM")
|| cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM")))
@@ -94,24 +93,40 @@ void cmGlobalGenerator::EnableLanguage(const char* lang,
"make program",
cmCacheManager::FILEPATH);
}
-
+
+}
+
+
+// enable the given language
+void cmGlobalGenerator::EnableLanguage(const char* lang,
+ cmMakefile *mf)
+{
+ if(!lang)
+ {
+ cmSystemTools::Error("EnableLanguage must have a lang specified!");
+ cmSystemTools::SetFatalErrorOccured();
+ return;
+ }
+ // setup some variables for the EnableLanguage function
bool isLocal = m_CMakeInstance->GetLocal();
- // if no lang specified use CXX
- if(!lang )
+ // if we are from the top, always define this
+ if(!isLocal)
{
- lang = "CXX";
+ mf->AddDefinition("RUN_CONFIGURE", true);
}
+ bool needTestLanguage = false;
std::string rootBin = mf->GetHomeOutputDirectory();
if(m_ConfiguredFilesPath.size())
{
rootBin = m_ConfiguredFilesPath;
}
- bool needCBackwards = false;
- bool needCXXBackwards = false;
- bool needTestFortran = false;
- if (!isLocal &&
- !this->GetLanguageEnabled("C") && !this->GetLanguageEnabled("CXX") &&
- !this->GetLanguageEnabled("JAVA") && !this->GetLanguageEnabled("FORTRAN"))
+
+ // **** Step 1, find and make sure CMAKE_MAKE_PROGRAM is defined
+ this->FindMakeProgram(mf);
+
+ // **** Step 2, Load the CMakeDetermineSystem.cmake file and find out
+ // what platform we are running on
+ if (!isLocal && !this->GetLanguageEnabled(lang))
{
#if defined(_WIN32) && !defined(__CYGWIN__)
/* Windows version number data. */
@@ -125,14 +140,20 @@ void cmGlobalGenerator::EnableLanguage(const char* lang,
mf->AddDefinition("CMAKE_SYSTEM_VERSION", windowsVersionString.str().c_str());
#endif
// Read the DetermineSystem file
- std::string systemFile = root;
- systemFile += "/Modules/CMakeDetermineSystem.cmake";
+ std::string systemFile = mf->GetModulesFile("CMakeDetermineSystem.cmake");
mf->ReadListFile(0, systemFile.c_str());
}
- // check for a C compiler and configure it
- if(!isLocal &&
- !this->GetLanguageEnabled("C") &&
- lang[0] == 'C')
+ // **** Step 3, load the CMakeSystem.cmake from the binary directory
+ // this file is configured by the CMakeDetermineSystem.cmake file
+ std::string fpath = rootBin;
+ if(!mf->GetDefinition("CMAKE_SYSTEM_LOADED"))
+ {
+ fpath += "/CMakeSystem.cmake";
+ mf->ReadListFile(0,fpath.c_str());
+ }
+ // **** Step 4, load the CMakeDetermine(LANG)Compiler.cmake file to find
+ // the compiler
+ if(!isLocal && !this->GetLanguageEnabled(lang) )
{
if (m_CMakeInstance->GetIsInTryCompile())
{
@@ -141,154 +162,117 @@ void cmGlobalGenerator::EnableLanguage(const char* lang,
"broken CMakeLists.txt file or a problematic release of "
"CMake");
}
- needCBackwards = true;
- // read determine C compiler
- std::string determineCFile = root;
- determineCFile += "/Modules/CMakeDetermineCCompiler.cmake";
- mf->ReadListFile(0,determineCFile.c_str());
- this->SetLanguageEnabled("C");
- // put CC in the environment in case user scripts want
- // to run configure
- if(mf->GetDefinition("CMAKE_C_COMPILER"))
- {
- std::string env = "CC=${CMAKE_C_COMPILER}";
- mf->ExpandVariablesInString(env);
- cmSystemTools::PutEnv(env.c_str());
- }
- }
-
- // check for a CXX compiler and configure it
- if(!isLocal &&
- !this->GetLanguageEnabled("CXX") &&
- strcmp(lang, "CXX") == 0)
- {
- needCXXBackwards = true;
- std::string determineCFile = root;
- determineCFile += "/Modules/CMakeDetermineCXXCompiler.cmake";
- mf->ReadListFile(0,determineCFile.c_str());
- this->SetLanguageEnabled("CXX");
- // put CXX in the environment in case user scripts want
- // to run configure
- if(mf->GetDefinition("CMAKE_CXX_COMPILER"))
+ needTestLanguage = true; // must test a language after finding it
+ // read determine LANG compiler
+ std::string determinCompiler = "CMakeDetermine";
+ determinCompiler += lang;
+ determinCompiler += "Compiler.cmake";
+ std::string determineFile = mf->GetModulesFile(determinCompiler.c_str());
+ if(!mf->ReadListFile(0,determineFile.c_str()))
{
- std::string env = "CXX=${CMAKE_CXX_COMPILER}";
- mf->ExpandVariablesInString(env);
- cmSystemTools::PutEnv(env.c_str());
+ cmSystemTools::Error("Could not find cmake module file:", determineFile.c_str());
}
- }
- // check for a Java compiler and configure it
- if(!isLocal &&
- !this->GetLanguageEnabled("JAVA") &&
- strcmp(lang, "JAVA") == 0)
- {
- std::string determineCFile = root;
- determineCFile += "/Modules/CMakeDetermineJavaCompiler.cmake";
- mf->ReadListFile(0,determineCFile.c_str());
- this->SetLanguageEnabled("JAVA");
- }
- // check for a Fortran compiler and configure it
- if(!isLocal &&
- !this->GetLanguageEnabled("FORTRAN") &&
- strcmp(lang, "FORTRAN") == 0)
- {
- needTestFortran = true;
- std::string determineCFile = root;
- determineCFile += "/Modules/CMakeDetermineFortranCompiler.cmake";
- mf->ReadListFile(0,determineCFile.c_str());
- this->SetLanguageEnabled("FORTRAN");
- }
-
- std::string fpath = rootBin;
- if(!mf->GetDefinition("CMAKE_SYSTEM_LOADED"))
- {
- fpath += "/CMakeSystem.cmake";
- mf->ReadListFile(0,fpath.c_str());
- }
- // if C, then enable C
- if(lang[0] == 'C' && !mf->GetDefinition("CMAKE_C_COMPILER_LOADED"))
- {
- fpath = rootBin;
- fpath += "/CMakeCCompiler.cmake";
- mf->ReadListFile(0,fpath.c_str());
- this->SetLanguageEnabled("C");
- }
- if(strcmp(lang, "CXX") == 0 && !mf->GetDefinition("CMAKE_CXX_COMPILER_LOADED"))
- {
- fpath = rootBin;
- fpath += "/CMakeCXXCompiler.cmake";
- mf->ReadListFile(0,fpath.c_str());
- this->SetLanguageEnabled("CXX");
+
+ this->SetLanguageEnabled(lang);
+ // put ${CMake_(LANG)_COMPILER_ENV_VAR}=${CMAKE_(LANG)_COMPILER into the
+ // environment, in case user scripts want to run configure, or sub cmakes
+ std::string compilerName = "CMAKE_";
+ compilerName += lang;
+ compilerName += "_COMPILER";
+ std::string compilerEnv = "CMAKE_";
+ compilerEnv += lang;
+ compilerEnv += "_COMPILER_ENV_VAR";
+ std::string envVar = mf->GetRequiredDefinition(compilerEnv.c_str());
+ std::string envVarValue = mf->GetRequiredDefinition(compilerName.c_str());
+ std::string env = envVar;
+ env += "=";
+ env += envVarValue;
+ cmSystemTools::PutEnv(env.c_str());
+ }
- }
- if(strcmp(lang, "JAVA") == 0 && !mf->GetDefinition("CMAKE_JAVA_COMPILER_LOADED"))
+ // **** Step 5, Load the configured language compiler file, if not loaded.
+ // look to see if CMAKE_(LANG)_COMPILER_LOADED is set,
+ // if not then load the CMake(LANG)Compiler.cmake file from the
+ // binary tree, this is a configured file provided by
+ // CMakeDetermine(LANG)Compiler.cmake
+ std::string loadedLang = "CMAKE_";
+ loadedLang += lang;
+ loadedLang += "_COMPILER_LOADED";
+ if(!mf->GetDefinition(loadedLang.c_str()))
{
fpath = rootBin;
- fpath += "/CMakeJavaCompiler.cmake";
- mf->ReadListFile(0,fpath.c_str());
- this->SetLanguageEnabled("JAVA");
+ fpath += "/CMake";
+ fpath += lang;
+ fpath += "Compiler.cmake";
+ if(!mf->ReadListFile(0,fpath.c_str()))
+ {
+ cmSystemTools::Error("Could not find cmake module file:", fpath.c_str());
+ }
+ this->SetLanguageEnabled(lang);
}
- if(strcmp(lang, "FORTRAN") == 0 && !mf->GetDefinition("CMAKE_FORTRAN_COMPILER_LOADED"))
+ // **** Step 6, Load the system specific information if not yet loaded
+ if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED"))
{
- fpath = rootBin;
- fpath += "/CMakeFortranCompiler.cmake";
- mf->ReadListFile(0,fpath.c_str());
- this->SetLanguageEnabled("FORTRAN");
+ fpath = mf->GetModulesFile("CMakeSystemSpecificInformation.cmake");
+ if(!mf->ReadListFile(0,fpath.c_str()))
+ {
+ cmSystemTools::Error("Could not find cmake module file:", fpath.c_str());
+ }
}
- if ( (lang[0] == 'C' || lang[0] == 'F') && !mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED"))
- {
- fpath = root;
- fpath += "/Modules/CMakeSystemSpecificInformation.cmake";
- mf->ReadListFile(0,fpath.c_str());
+ std::string langLoadedVar = "CMAKE_";
+ langLoadedVar += lang;
+ langLoadedVar += "_INFORMATION_LOADED";
+ if (!mf->GetDefinition(langLoadedVar.c_str()))
+ {
+ fpath = "CMake";
+ fpath += lang;
+ fpath += "Information.cmake";
+ fpath = mf->GetModulesFile(fpath.c_str());
+ if(!mf->ReadListFile(0,fpath.c_str()))
+ {
+ cmSystemTools::Error("Could not find cmake module file:", fpath.c_str());
+ }
}
+ // **** Step 7, Test the compiler for the language just setup
+ // At this point we should have enough info for a try compile
+ // which is used in the backward stuff
if(!isLocal)
{
- // At this point we should have enough info for a try compile
- // which is used in the backward stuff
- if(needCBackwards)
+ if(needTestLanguage)
{
if (!m_CMakeInstance->GetIsInTryCompile())
{
- std::string ifpath = root + "/Modules/CMakeTestCCompiler.cmake";
- mf->ReadListFile(0,ifpath.c_str());
- // for old versions of CMake ListFiles
- const char* versionValue
- = mf->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY");
- if (atof(versionValue) <= 1.4)
+ std::string testLang = "CMakeTest";
+ testLang += lang;
+ testLang += "Compiler.cmake";
+ std::string ifpath = mf->GetModulesFile(testLang.c_str());
+ if(!mf->ReadListFile(0,ifpath.c_str()))
{
- ifpath = root + "/Modules/CMakeBackwardCompatibilityC.cmake";
- mf->ReadListFile(0,ifpath.c_str());
+ cmSystemTools::Error("Could not find cmake module file:", ifpath.c_str());
}
- }
- }
- if(needCXXBackwards)
- {
- if (!m_CMakeInstance->GetIsInTryCompile())
- {
- std::string ifpath = root + "/Modules/CMakeTestCXXCompiler.cmake";
- mf->ReadListFile(0,ifpath.c_str());
- // for old versions of CMake ListFiles
+ // **** Step 8, 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
const char* versionValue
= mf->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY");
if (atof(versionValue) <= 1.4)
{
- std::string nfpath = root + "/Modules/CMakeBackwardCompatibilityCXX.cmake";
- mf->ReadListFile(0,nfpath.c_str());
+ 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());
+ }
+
}
}
}
- if(needTestFortran)
- {
- if (!m_CMakeInstance->GetIsInTryCompile())
- {
- std::string ifpath = root + "/Modules/CMakeTestFortranCompiler.cmake";
- mf->ReadListFile(0,ifpath.c_str());
- }
- }
-
- // if we are from the top, always define this
- mf->AddDefinition("RUN_CONFIGURE", true);
}
}
@@ -564,16 +548,10 @@ void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen )
this->GetCMakeInstance()->AddCacheEntry("CMAKE_MAKE_PROGRAM", make,
"make program",
cmCacheManager::FILEPATH);
- // if C, then enable C
- if(gen->GetLanguageEnabled("C"))
- {
- this->SetLanguageEnabled("C");
- }
-
- // if CXX
- if(gen->GetLanguageEnabled("CXX"))
+ for(std::map<cmStdString, bool>::iterator i = gen->m_LanguageEnabled.begin();
+ i != gen->m_LanguageEnabled.end(); ++i)
{
- this->SetLanguageEnabled("CXX");
+ this->SetLanguageEnabled(i->first.c_str());
}
}
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index b963316..71b1859 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -107,7 +107,8 @@ public:
bool GetForceUnixPaths() {return m_ForceUnixPaths;}
protected:
bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen);
-
+ void FindMakeProgram(cmMakefile*);
+
bool m_ForceUnixPaths;
cmStdString m_FindMakeProgramFile;
cmStdString m_ConfiguredFilesPath;
diff --git a/Source/cmGlobalUnixMakefileGenerator.cxx b/Source/cmGlobalUnixMakefileGenerator.cxx
index 463c209..170c97b 100644
--- a/Source/cmGlobalUnixMakefileGenerator.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator.cxx
@@ -32,11 +32,8 @@ void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
{
mf->AddDefinition("CMAKE_CFG_INTDIR",".");
this->cmGlobalGenerator::EnableLanguage(lang, mf);
- if(!lang)
- {
- lang = "CXX";
- }
- if(lang[0] == 'C')
+ std::string path;
+ if(strcmp(lang, "C") == 0)
{
if(!mf->GetDefinition("CMAKE_C_COMPILER"))
{
@@ -44,7 +41,7 @@ void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
return;
}
const char* cc = mf->GetRequiredDefinition("CMAKE_C_COMPILER");
- std::string path = cmSystemTools::FindProgram(cc);
+ path = cmSystemTools::FindProgram(cc);
if(path.size() == 0)
{
std::string message = "your C compiler: ";
@@ -62,28 +59,28 @@ void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
" and re-run CMake.";
cmSystemTools::Error(message.c_str());
}
- if(strcmp(lang, "CXX") == 0)
+ }
+ if(strcmp(lang, "CXX") == 0)
+ {
+ const char* cxx = mf->GetRequiredDefinition("CMAKE_CXX_COMPILER");
+ path = cmSystemTools::FindProgram(cxx);
+ if(path.size() == 0)
{
- const char* cxx = mf->GetRequiredDefinition("CMAKE_CXX_COMPILER");
- path = cmSystemTools::FindProgram(cxx);
- if(path.size() == 0)
+ std::string message = "your C++ compiler: ";
+ if(cxx)
{
- std::string message = "your C++ compiler: ";
- if(cxx)
- {
- message += cxx;
- }
- else
- {
- message += "(NULL)";
- }
-
- 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());
+ message += cxx;
+ }
+ else
+ {
+ message += "(NULL)";
}
+
+ 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());
}
}
}
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index e56b19b..092d73b 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -89,7 +89,6 @@ bool cmListFileCache::CacheFile(const char* path, bool requireProjectCommand)
{
return false;
}
-
// Get a pointer to a persistent copy of the name.
const char* filename = this->GetUniqueStringPointer(path);
diff --git a/Source/cmLocalUnixMakefileGenerator.cxx b/Source/cmLocalUnixMakefileGenerator.cxx
index 63de272..b00b7e4 100644
--- a/Source/cmLocalUnixMakefileGenerator.cxx
+++ b/Source/cmLocalUnixMakefileGenerator.cxx
@@ -995,21 +995,21 @@ static RuleVariables ruleReplaceVars[] =
{"<CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS>", "CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS"},
{"<CMAKE_SHARED_MODULE_CREATE_FORTAN_FLAGS>", "CMAKE_SHARED_MODULE_CREATE_FORTAN_FLAGS"},
{"<CMAKE_SHARED_MODULE_C_FLAGS>", "CMAKE_SHARED_MODULE_C_FLAGS"},
- {"<CMAKE_SHARED_MODULE_FORTRAN_FLAGS>", "CMAKE_SHARED_MODULE_FORTRAN_FLAGS"},
+ {"<CMAKE_SHARED_MODULE_Fortran_FLAGS>", "CMAKE_SHARED_MODULE_Fortran_FLAGS"},
{"<CMAKE_SHARED_MODULE_CXX_FLAGS>", "CMAKE_SHARED_MODULE_CXX_FLAGS"},
{"<CMAKE_SHARED_LIBRARY_C_FLAGS>", "CMAKE_SHARED_LIBRARY_C_FLAGS"},
- {"<CMAKE_SHARED_LIBRARY_FORTRAN_FLAGS>", "CMAKE_SHARED_LIBRARY_FORTRAN_FLAGS"},
+ {"<CMAKE_SHARED_LIBRARY_Fortran_FLAGS>", "CMAKE_SHARED_LIBRARY_Fortran_FLAGS"},
{"<CMAKE_SHARED_LIBRARY_CXX_FLAGS>", "CMAKE_SHARED_LIBRARY_CXX_FLAGS"},
{"<CMAKE_CXX_LINK_FLAGS>", "CMAKE_CXX_LINK_FLAGS"},
{"<CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS>", "CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS"},
- {"<CMAKE_SHARED_LIBRARY_CREATE_FORTRAN_FLAGS>", "CMAKE_SHARED_LIBRARY_CREATE_FORTRAN_FLAGS"},
+ {"<CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS>", "CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS"},
{"<CMAKE_SHARED_MODULE_CREATE_C_FLAGS>", "CMAKE_SHARED_MODULE_CREATE_C_FLAGS"},
{"<CMAKE_SHARED_LIBRARY_SONAME_C_FLAG>", "CMAKE_SHARED_LIBRARY_SONAME_C_FLAG"},
- {"<CMAKE_SHARED_LIBRARY_SONAME_FORTRAN_FLAG>", "CMAKE_SHARED_LIBRARY_SONAME_FORTRAN_FLAG"},
+ {"<CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG>", "CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG"},
{"<CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG>", "CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG"},
{"<CMAKE_C_LINK_FLAGS>", "CMAKE_C_LINK_FLAGS"},
- {"<CMAKE_FORTRAN_LINK_FLAGS>", "CMAKE_FORTRAN_LINK_FLAGS"},
+ {"<CMAKE_Fortran_LINK_FLAGS>", "CMAKE_Fortran_LINK_FLAGS"},
{"<CMAKE_AR>", "CMAKE_AR"},
{"<CMAKE_RANLIB>", "CMAKE_RANLIB"},
@@ -1037,8 +1037,8 @@ cmLocalUnixMakefileGenerator::ExpandRuleVariables(std::string& s,
std::string ccompiler = this->ConvertToOutputForExisting(
m_Makefile->GetSafeDefinition("CMAKE_C_COMPILER"));
std::string fcompiler = this->ConvertToOutputForExisting(
- m_Makefile->GetSafeDefinition("CMAKE_FORTRAN_COMPILER"));
- cmSystemTools::ReplaceString(s, "<CMAKE_FORTRAN_COMPILER>", fcompiler.c_str());
+ m_Makefile->GetSafeDefinition("CMAKE_Fortran_COMPILER"));
+ cmSystemTools::ReplaceString(s, "<CMAKE_Fortran_COMPILER>", fcompiler.c_str());
cmSystemTools::ReplaceString(s, "<CMAKE_CXX_COMPILER>", cxxcompiler.c_str());
cmSystemTools::ReplaceString(s, "<CMAKE_C_COMPILER>", ccompiler.c_str());
if(linkFlags)
@@ -1297,7 +1297,7 @@ void cmLocalUnixMakefileGenerator::OutputSharedLibraryRule(std::ostream& fout,
{
if(t.HasFortran())
{
- createRule = "CMAKE_FORTRAN_CREATE_SHARED_LIBRARY";
+ createRule = "CMAKE_Fortran_CREATE_SHARED_LIBRARY";
}
else
{
@@ -1351,11 +1351,19 @@ void cmLocalUnixMakefileGenerator::OutputModuleLibraryRule(std::ostream& fout,
if(t.HasCxx())
{
createRule = "CMAKE_CXX_CREATE_SHARED_MODULE";
- }
+ }
else
{
- createRule = "CMAKE_C_CREATE_SHARED_MODULE";
+ if(t.HasFortran())
+ {
+ createRule = "CMAKE_Fortran_CREATE_SHARED_MODULE";
+ }
+ else
+ {
+ createRule = "CMAKE_C_CREATE_SHARED_MODULE";
+ }
}
+
std::string buildType = m_Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
buildType = cmSystemTools::UpperCase(buildType);
std::string linkFlags = m_Makefile->GetSafeDefinition("CMAKE_MODULE_LINKER_FLAGS");
@@ -1391,8 +1399,16 @@ void cmLocalUnixMakefileGenerator::OutputStaticLibraryRule(std::ostream& fout,
}
else
{
- createRule = "CMAKE_C_CREATE_STATIC_LIBRARY";
- }
+ if(t.HasFortran())
+ {
+ createRule = "CMAKE_Fortran_CREATE_STATIC_LIBRARY";
+ }
+ else
+ {
+ createRule = "CMAKE_C_CREATE_STATIC_LIBRARY";
+ }
+ }
+
std::string linkFlags;
const char* targetLinkFlags = t.GetProperty("STATIC_LIBRARY_FLAGS");
if(targetLinkFlags)
@@ -1482,10 +1498,10 @@ void cmLocalUnixMakefileGenerator::OutputExecutableRule(std::ostream& fout,
{
if(t.HasFortran())
{
- rules.push_back(m_Makefile->GetRequiredDefinition("CMAKE_FORTRAN_LINK_EXECUTABLE"));
- flags += m_Makefile->GetSafeDefinition("CMAKE_FORTRAN_FLAGS");
+ rules.push_back(m_Makefile->GetRequiredDefinition("CMAKE_Fortran_LINK_EXECUTABLE"));
+ flags += m_Makefile->GetSafeDefinition("CMAKE_Fortran_FLAGS");
flags += " ";
- flags += m_Makefile->GetSafeDefinition("CMAKE_SHARED_LIBRARY_FORTRAN_FLAGS");
+ flags += m_Makefile->GetSafeDefinition("CMAKE_SHARED_LIBRARY_Fortran_FLAGS");
flags += " ";
}
else
@@ -2879,24 +2895,24 @@ OutputBuildObjectFromSource(std::ostream& fout,
}
case cmSystemTools::FORTRAN_FILE_FORMAT:
{
- rules.push_back(m_Makefile->GetRequiredDefinition("CMAKE_FORTRAN_COMPILE_OBJECT"));
- flags += m_Makefile->GetSafeDefinition("CMAKE_FORTRAN_FLAGS");
+ rules.push_back(m_Makefile->GetRequiredDefinition("CMAKE_Fortran_COMPILE_OBJECT"));
+ flags += m_Makefile->GetSafeDefinition("CMAKE_Fortran_FLAGS");
flags += " ";
if(buildType.size())
{
- std::string build = "CMAKE_FORTRAN_FLAGS_";
+ std::string build = "CMAKE_Fortran_FLAGS_";
build += buildType;
flags += m_Makefile->GetSafeDefinition(build.c_str());
flags += " ";
}
if(shared)
{
- flags += m_Makefile->GetSafeDefinition("CMAKE_SHARED_LIBRARY_FORTRAN_FLAGS");
+ flags += m_Makefile->GetSafeDefinition("CMAKE_SHARED_LIBRARY_Fortran_FLAGS");
flags += " ";
}
if(cmSystemTools::IsOn(m_Makefile->GetDefinition("BUILD_SHARED_LIBS")))
{
- flags += m_Makefile->GetSafeDefinition("CMAKE_SHARED_BUILD_FORTRAN_FLAGS");
+ flags += m_Makefile->GetSafeDefinition("CMAKE_SHARED_BUILD_Fortran_FLAGS");
flags += " ";
}
break;
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 8f48fd6..41592e7 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -57,7 +57,9 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args)
}
else
{
- m_Makefile->EnableLanguage(0);
+ // if no language is specified do c and c++
+ m_Makefile->EnableLanguage("C");
+ m_Makefile->EnableLanguage("CXX");
}
return true;
}
diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx
index b72f14d..47c3bd4 100644
--- a/Source/cmTryCompileCommand.cxx
+++ b/Source/cmTryCompileCommand.cxx
@@ -158,7 +158,7 @@ int cmTryCompileCommand::CoreTryCompileCode(
}
else if ( format == cmSystemTools::FORTRAN_FILE_FORMAT )
{
- fprintf(fout, "PROJECT(CMAKE_TRY_COMPILE FORTRAN)\n");
+ fprintf(fout, "PROJECT(CMAKE_TRY_COMPILE Fortran)\n");
}
else
{
@@ -187,8 +187,8 @@ int cmTryCompileCommand::CoreTryCompileCode(
}
if(format == cmSystemTools::FORTRAN_FILE_FORMAT )
{
- const char* fflags = mf->GetDefinition("CMAKE_FORTRAN_FLAGS");
- fprintf(fout, "SET(CMAKE_FORTRAN_FLAGS \"${CMAKE_FORTRAN_FLAGS} ");
+ const char* fflags = mf->GetDefinition("CMAKE_Fortran_FLAGS");
+ fprintf(fout, "SET(CMAKE_Fortran_FLAGS \"${CMAKE_Fortran_FLAGS} ");
if(fflags)
{
fprintf(fout, " %s ", fflags);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index ca07acf..ae57145 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -560,7 +560,7 @@ int cmake::AddCMakePaths(const char *arg0)
if (getenv("CMAKE_ROOT"))
{
cMakeRoot = getenv("CMAKE_ROOT");
- modules = cMakeRoot + "/Modules/CMakeDefaultMakeRuleVariables.cmake";
+ modules = cMakeRoot + "/Modules/CMake.cmake";
}
if(!cmSystemTools::FileExists(modules.c_str()))
{
@@ -572,21 +572,21 @@ int cmake::AddCMakePaths(const char *arg0)
cMakeRoot = cMakeRoot.substr(0, slashPos);
}
// is there no Modules direcory there?
- modules = cMakeRoot + "/Modules/CMakeDefaultMakeRuleVariables.cmake";
+ modules = cMakeRoot + "/Modules/CMake.cmake";
}
if (!cmSystemTools::FileExists(modules.c_str()))
{
// try exe/../share/cmake
cMakeRoot += CMAKE_DATA_DIR;
- modules = cMakeRoot + "/Modules/CMakeDefaultMakeRuleVariables.cmake";
+ modules = cMakeRoot + "/Modules/CMake.cmake";
}
#ifdef CMAKE_ROOT_DIR
if (!cmSystemTools::FileExists(modules.c_str()))
{
// try compiled in root directory
cMakeRoot = CMAKE_ROOT_DIR;
- modules = cMakeRoot + "/Modules/CMakeDefaultMakeRuleVariables.cmake";
+ modules = cMakeRoot + "/Modules/CMake.cmake";
}
#endif
#ifdef CMAKE_PREFIX
@@ -594,7 +594,7 @@ int cmake::AddCMakePaths(const char *arg0)
{
// try compiled in install prefix
cMakeRoot = CMAKE_PREFIX CMAKE_DATA_DIR;
- modules = cMakeRoot + "/Modules/CMakeDefaultMakeRuleVariables.cmake";
+ modules = cMakeRoot + "/Modules/CMake.cmake";
}
#endif
if (!cmSystemTools::FileExists(modules.c_str()))
@@ -602,14 +602,14 @@ int cmake::AddCMakePaths(const char *arg0)
// try
cMakeRoot = cmSystemTools::GetProgramPath(cMakeSelf.c_str());
cMakeRoot += CMAKE_DATA_DIR;
- modules = cMakeRoot + "/Modules/CMakeDefaultMakeRuleVariables.cmake";
+ modules = cMakeRoot + "/Modules/CMake.cmake";
}
if(!cmSystemTools::FileExists(modules.c_str()))
{
// next try exe
cMakeRoot = cmSystemTools::GetProgramPath(cMakeSelf.c_str());
// is there no Modules direcory there?
- modules = cMakeRoot + "/Modules/CMakeDefaultMakeRuleVariables.cmake";
+ modules = cMakeRoot + "/Modules/CMake.cmake";
}
if (!cmSystemTools::FileExists(modules.c_str()))
{