summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2002-11-08 20:46:08 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2002-11-08 20:46:08 (GMT)
commitf5d95fb078ec48755762931fe2882ed1cbe1171e (patch)
tree945dca55d34b543db452c586aba0de863cf25cec /Source
parentc72462ffb1c75573e0d67a7101438a62bfc2fda1 (diff)
downloadCMake-f5d95fb078ec48755762931fe2882ed1cbe1171e.zip
CMake-f5d95fb078ec48755762931fe2882ed1cbe1171e.tar.gz
CMake-f5d95fb078ec48755762931fe2882ed1cbe1171e.tar.bz2
Complete rework of makefile generators expect trouble
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt2
-rw-r--r--Source/MFCDialog/CMakeSetupDialog.cpp1
-rw-r--r--Source/TODO52
-rw-r--r--Source/cmExecProgramCommand.cxx9
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.cxx23
-rw-r--r--Source/cmGlobalGenerator.cxx3
-rw-r--r--Source/cmGlobalGenerator.h5
-rw-r--r--Source/cmGlobalNMakeMakefileGenerator.cxx28
-rw-r--r--Source/cmGlobalNMakeMakefileGenerator.h9
-rw-r--r--Source/cmGlobalUnixMakefileGenerator.cxx167
-rw-r--r--Source/cmGlobalUnixMakefileGenerator.h2
-rw-r--r--Source/cmIfCommand.cxx18
-rw-r--r--Source/cmLoadCommandCommand.cxx6
-rw-r--r--Source/cmLocalUnixMakefileGenerator.cxx949
-rw-r--r--Source/cmLocalUnixMakefileGenerator.h79
-rw-r--r--Source/cmMakefile.cxx3
-rw-r--r--Source/cmStandardIncludes.h4
-rw-r--r--Source/cmSystemTools.cxx26
-rw-r--r--Source/cmSystemTools.h10
-rw-r--r--Source/cmTryCompileCommand.cxx2
-rw-r--r--Source/cmWin32ProcessExecution.cxx21
-rw-r--r--Source/cmWin32ProcessExecution.h8
-rw-r--r--Source/ctest.cxx8
23 files changed, 952 insertions, 483 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 2384b96..a25f1d7 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -61,9 +61,7 @@ IF (WIN32)
IF(NOT UNIX)
SET(SRCS ${SRCS}
cmGlobalBorlandMakefileGenerator.cxx
- cmLocalBorlandMakefileGenerator.cxx
cmGlobalNMakeMakefileGenerator.cxx
- cmLocalNMakeMakefileGenerator.cxx
cmGlobalVisualStudio6Generator.cxx
cmLocalVisualStudio6Generator.cxx
cmGlobalVisualStudio7Generator.cxx
diff --git a/Source/MFCDialog/CMakeSetupDialog.cpp b/Source/MFCDialog/CMakeSetupDialog.cpp
index e5140ba..a76dc7b 100644
--- a/Source/MFCDialog/CMakeSetupDialog.cpp
+++ b/Source/MFCDialog/CMakeSetupDialog.cpp
@@ -122,6 +122,7 @@ CMakeSetupDialog::CMakeSetupDialog(const CMakeCommandLineInfo& cmdInfo,
CWnd* pParent /*=NULL*/)
: CDialog(CMakeSetupDialog::IDD, pParent)
{
+ cmSystemTools::SetRunCommandHideConsole(true);
cmSystemTools::SetErrorCallback(MFCMessageCallback);
m_RegistryKey = "Software\\Kitware\\CMakeSetup\\Settings\\StartPath";
m_CacheEntriesList.m_CMakeSetupDialog = this;
diff --git a/Source/TODO b/Source/TODO
new file mode 100644
index 0000000..32ff833
--- /dev/null
+++ b/Source/TODO
@@ -0,0 +1,52 @@
+Variables:
+
+CMAKE_SYSTEM
+
+CMAKE_BUILD_TOOL borlandmake make nmake msdev devenv
+CMAKE_MAKE_PROGRAM make nmake msdev devenv *** HAS TO BE IN CACHE for try compile to work
+CMAKE_BUILD_TYPE Debug Release RelWithDebInfo MinSizeRel
+BUILD_COMMAND needs to be removed
+
+CMAKE_ANSI_CFLAGS
+CMAKE_ANSI_CXXFLAGS
+CMAKE_NO_ANSI_STRING_STREAM
+CMAKE_NO_STD_NAMESPACE
+CMAKE_NO_ANSI_FOR_SCOPE
+CMAKE_COMPILER_IS_GNUCXX
+CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION
+
+
+CMAKE_CXX_FLAGS
+CMAKE_CXX_FLAGS_DEBUG
+CMAKE_CXX_FLAGS_MINSIZEREL
+CMAKE_CXX_FLAGS_RELEASE
+CMAKE_CXX_FLAGS_RELWITHDEBINFO
+
+CMAKE_C_FLAGS
+CMAKE_C_FLAGS_DEBUG
+CMAKE_C_FLAGS_MINSIZEREL
+CMAKE_C_FLAGS_RELEASE
+CMAKE_C_FLAGS_RELWITHDEBINFO
+
+CMAKE_CXX_LINK_DEBUG_FLAGS
+CMAKE_CXX_LINK_RELEASE_FLAGS
+CMAKE_CXX_LINK_RELWITHDEBINFO_FLAGS
+CMAKE_CXX_LINK_MINSIZEREL_FLAGS
+
+CMAKE_C_LINK_DEBUG_FLAGS
+CMAKE_C_LINK_RELEASE_FLAGS
+CMAKE_C_LINK_RELWITHDEBINFO_FLAGS
+CMAKE_C_LINK_MINSIZEREL_FLAGS
+
+
+CMAKE_USE_WIN32_THREADS
+CMAKE_USE_SPROC
+CMAKE_USE_PTHREADS
+CMAKE_HP_PTHREADS
+CMAKE_THREAD_LIBS
+CMAKE_DL_LIBS
+
+CMAKE_X_LIBS
+CMAKE_X_CFLAGS
+CMAKE_HAS_X
+
diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx
index 82a5672..b6159ea 100644
--- a/Source/cmExecProgramCommand.cxx
+++ b/Source/cmExecProgramCommand.cxx
@@ -118,6 +118,15 @@ bool cmExecProgramCommand::InitialPass(std::vector<std::string> const& args)
{
std::string::size_type first = output.find_first_not_of(" \n\t\r");
std::string::size_type last = output.find_last_not_of(" \n\t\r");
+ if(first == std::string::npos)
+ {
+ first = 0;
+ }
+ if(last == std::string::npos)
+ {
+ last = output.size()-1;
+ }
+
std::string coutput = std::string(output, first, last-first+1);
m_Makefile->AddDefinition(output_variable.c_str(), coutput.c_str());
}
diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx
index 5fb3612..e53fee6 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.cxx
+++ b/Source/cmGlobalBorlandMakefileGenerator.cxx
@@ -15,11 +15,11 @@
=========================================================================*/
#include "cmGlobalBorlandMakefileGenerator.h"
-#include "cmLocalBorlandMakefileGenerator.h"
+#include "cmLocalUnixMakefileGenerator.h"
#include "cmMakefile.h"
#include "cmake.h"
-void cmGlobalBorlandMakefileGenerator::EnableLanguage(const char*,
+void cmGlobalBorlandMakefileGenerator::EnableLanguage(const char* l,
cmMakefile *mf)
{
// now load the settings
@@ -37,20 +37,21 @@ void cmGlobalBorlandMakefileGenerator::EnableLanguage(const char*,
message += outdir;
cmSystemTools::Error(message.c_str());
}
- if(!this->GetLanguageEnabled("CXX"))
- {
- std::string fpath =
- mf->GetDefinition("CMAKE_ROOT");
- fpath += "/Templates/CMakeBorlandWindowsSystemConfig.cmake";
- mf->ReadListFile(NULL,fpath.c_str());
- this->SetLanguageEnabled("CXX");
- }
+ mf->AddDefinition("BORLAND", "1");
+ mf->AddDefinition("CMAKE_GENERATOR_CC", "bcc32");
+ mf->AddDefinition("CMAKE_GENERATOR_CXX", "bcc32");
+
+ this->cmGlobalUnixMakefileGenerator::EnableLanguage(l, mf);
}
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator()
{
- cmLocalGenerator *lg = new cmLocalBorlandMakefileGenerator;
+ cmLocalUnixMakefileGenerator *lg = new cmLocalUnixMakefileGenerator;
+ lg->SetIncludeDirective("!include");
+ lg->SetWindowsShell(true);
+ lg->SetMakefileVariableSize(32);
+
lg->SetGlobalGenerator(this);
return lg;
}
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index f7f0ec0..bdb0d14 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -213,8 +213,7 @@ cmLocalGenerator *cmGlobalGenerator::CreateLocalGenerator()
return lg;
}
-void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen,
- cmMakefile *)
+void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen )
{
// create a temp generator
cmLocalGenerator *lg = this->CreateLocalGenerator();
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 9a00b90..11f3704 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -79,8 +79,7 @@ public:
/**
* Try to determine system infomation, get it from another generator
*/
- virtual void EnableLanguagesFromGenerator(cmGlobalGenerator *gen,
- cmMakefile *mf);
+ virtual void EnableLanguagesFromGenerator(cmGlobalGenerator *gen);
/**
* Try running cmake and building a file. This is used for dynalically
@@ -98,7 +97,9 @@ public:
cmake *GetCMakeInstance() {
return this->m_CMakeInstance; };
+ void SetConfiguredFilesPath(const char* s){m_ConfiguredFilesPath = s;}
protected:
+ cmStdString m_ConfiguredFilesPath;
cmake *m_CMakeInstance;
std::vector<cmLocalGenerator *> m_LocalGenerators;
diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx
index d2bd056..ce0dbd2 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.cxx
+++ b/Source/cmGlobalNMakeMakefileGenerator.cxx
@@ -15,33 +15,25 @@
=========================================================================*/
#include "cmGlobalNMakeMakefileGenerator.h"
-#include "cmLocalNMakeMakefileGenerator.h"
+#include "cmLocalUnixMakefileGenerator.h"
#include "cmMakefile.h"
-void cmGlobalNMakeMakefileGenerator::EnableLanguage(const char*,
+void cmGlobalNMakeMakefileGenerator::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;
- }
- if(!this->GetLanguageEnabled("CXX"))
- {
- std::string fpath =
- mf->GetDefinition("CMAKE_ROOT");
- fpath += "/Templates/CMakeNMakeWindowsSystemConfig.cmake";
- mf->ReadListFile(NULL,fpath.c_str());
- this->SetLanguageEnabled("CXX");
- }
+ // pick a default
+ mf->AddDefinition("CMAKE_GENERATOR_CC", "cl");
+ mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl");
+
+ this->cmGlobalUnixMakefileGenerator::EnableLanguage(l, mf);
}
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalNMakeMakefileGenerator::CreateLocalGenerator()
{
- cmLocalGenerator *lg = new cmLocalNMakeMakefileGenerator;
+ cmLocalUnixMakefileGenerator *lg = new cmLocalUnixMakefileGenerator;
+ lg->SetWindowsShell(true);
+ lg->SetMakeSilentFlag("/nologo");
lg->SetGlobalGenerator(this);
return lg;
}
diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h
index 6bd5734..c125cba 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.h
+++ b/Source/cmGlobalNMakeMakefileGenerator.h
@@ -41,15 +41,6 @@ public:
*/
virtual void EnableLanguage(const char*,cmMakefile *mf);
- /**
- * Try to determine system infomation from another generator
- */
- virtual void EnableLanguagesFromGenerator(cmGlobalGenerator *gen,
- cmMakefile *mf)
- {
- this->cmGlobalGenerator::EnableLanguagesFromGenerator(gen,mf);
- }
-
};
#endif
diff --git a/Source/cmGlobalUnixMakefileGenerator.cxx b/Source/cmGlobalUnixMakefileGenerator.cxx
index ee1454b..aeb3e41 100644
--- a/Source/cmGlobalUnixMakefileGenerator.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator.cxx
@@ -23,47 +23,83 @@
void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
cmMakefile *mf)
{
- // only do for global runs
- if (!m_CMakeInstance->GetLocal())
+ // if no lang specified use CXX
+ if(!lang )
{
- std::string output;
- std::string root
- = cmSystemTools::ConvertToOutputPath(mf->GetDefinition("CMAKE_ROOT"));
- // if no lang specified use CXX
- if(!lang )
+ lang = "CXX";
+ }
+ std::string root
+ = cmSystemTools::ConvertToOutputPath(mf->GetDefinition("CMAKE_ROOT"));
+ std::string rootBin = mf->GetHomeOutputDirectory();
+ if(m_ConfiguredFilesPath.size())
+ {
+ rootBin = m_ConfiguredFilesPath;
+ }
+ bool needCBackwards = false;
+ bool needCXXBackwards = false;
+
+ // check for a C compiler and configure it
+ if(!m_CMakeInstance->GetLocal() &&
+ !this->GetLanguageEnabled("C") &&
+ lang[0] == 'C')
+ {
+ if (m_CMakeInstance->GetIsInTryCompile())
{
- lang = "CXX";
+ cmSystemTools::Error("This should not have happen. "
+ "If you see this message, you are probably using a "
+ "broken CMakeLists.txt file or a problematic release of "
+ "CMake");
}
- // if CXX or C, then enable C
- if((!this->GetLanguageEnabled("C") && lang[0] == 'C'))
+ needCBackwards = true;
+ // Read the DetermineSystem file
+ std::string systemFile = root;
+ systemFile += "/Modules/CMakeDetermineSystem.cmake";
+ mf->ReadListFile(0, systemFile.c_str());
+ // read determine C compiler
+ std::string determineCFile = root;
+ determineCFile += "/Modules/CMakeDetermineCCompiler.cmake";
+ mf->ReadListFile(0,determineCFile.c_str());
+ this->SetLanguageEnabled("C");
+ }
+
+ // check for a CXX compiler and configure it
+ if(!m_CMakeInstance->GetLocal() &&
+ !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");
+ }
+
+
+ std::string fpath = rootBin;
+ fpath += "/CMakeSystem.cmake";
+ mf->ReadListFile(0,fpath.c_str());
+ // if C, then enable C
+ if(lang[0] == 'C')
+ {
+ fpath = rootBin;
+ fpath += "/CMakeCCompiler.cmake";
+ mf->ReadListFile(0,fpath.c_str());
+ }
+ if(strcmp(lang, "CXX") == 0)
+ {
+ fpath = rootBin;
+ fpath += "/CMakeCXXCompiler.cmake";
+ mf->ReadListFile(0,fpath.c_str());
+ }
+ fpath = root;
+ fpath += "/Modules/CMakeSystemSpecificInformation.cmake";
+ mf->ReadListFile(0,fpath.c_str());
+ if(!m_CMakeInstance->GetLocal())
+ {
+ // At this point we should have enough info for a try compile
+ // which is used in the backward stuff
+ if(needCBackwards)
{
- static char envCC[5000];
- if(mf->GetDefinition("CMAKE_C_COMPILER"))
- {
- std::string env = "CC=${CMAKE_C_COMPILER}";
- mf->ExpandVariablesInString(env);
- strncpy(envCC, env.c_str(), 4999);
- envCC[4999] = 0;
- putenv(envCC);
- }
- if (m_CMakeInstance->GetIsInTryCompile())
- {
- cmSystemTools::Error("This should not have happen. "
- "If you see this message, you are probably using a "
- "broken CMakeLists.txt file or a problematic release of "
- "CMake");
- }
-
- std::string cmd = root;
- cmd += "/Templates/cconfigure";
- cmSystemTools::RunCommand(cmd.c_str(), output,
- cmSystemTools::ConvertToOutputPath(
- mf->GetHomeOutputDirectory()).c_str());
-
- std::string fpath = mf->GetHomeOutputDirectory();
- fpath += "/CCMakeSystemConfig.cmake";
- mf->ReadListFile(0,fpath.c_str());
- this->SetLanguageEnabled("C");
if (!m_CMakeInstance->GetIsInTryCompile())
{
// for old versions of CMake ListFiles
@@ -72,41 +108,12 @@ void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
if (!versionValue || atof(versionValue) <= 1.4)
{
std::string ifpath = root + "/Modules/CMakeBackwardCompatibilityC.cmake";
- mf->ReadListFile(0,ifpath.c_str());
+ mf->ReadListFile(0,ifpath.c_str());
}
}
}
- // if CXX
- if(!this->GetLanguageEnabled("CXX") && strcmp(lang, "CXX") == 0)
+ if(needCXXBackwards)
{
- // see man putenv for explaination of this stupid code....
- static char envCXX[5000];
- if(mf->GetDefinition("CMAKE_CXX_COMPILER"))
- {
- std::string env = "CXX=${CMAKE_CXX_COMPILER}";
- mf->ExpandVariablesInString(env);
- strncpy(envCXX, env.c_str(), 4999);
- envCXX[4999] = 0;
- putenv(envCXX);
- }
- std::string cmd = root;
- if (m_CMakeInstance->GetIsInTryCompile())
- {
- cmSystemTools::Error("This should not have happen. "
- "If you see this message, you are probably using a "
- "broken CMakeLists.txt file or a problematic release of "
- "CMake");
- }
- cmd += "/Templates/cxxconfigure";
- cmSystemTools::RunCommand(cmd.c_str(), output,
- cmSystemTools::ConvertToOutputPath(
- mf->GetHomeOutputDirectory()).c_str());
-
- std::string fpath = mf->GetHomeOutputDirectory();
- fpath += "/CXXCMakeSystemConfig.cmake";
- mf->ReadListFile(0,fpath.c_str());
- this->SetLanguageEnabled("CXX");
-
if (!m_CMakeInstance->GetIsInTryCompile())
{
// for old versions of CMake ListFiles
@@ -114,12 +121,11 @@ void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
= mf->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
if (!versionValue || atof(versionValue) <= 1.4)
{
- fpath = root + "/Modules/CMakeBackwardCompatibilityCXX.cmake";
- mf->ReadListFile(0,fpath.c_str());
+ std::string fpath = root + "/Modules/CMakeBackwardCompatibilityCXX.cmake";
+ mf->ReadListFile(0,fpath.c_str());
}
}
}
-
// if we are from the top, always define this
mf->AddDefinition("RUN_CONFIGURE", true);
}
@@ -133,33 +139,18 @@ cmLocalGenerator *cmGlobalUnixMakefileGenerator::CreateLocalGenerator()
return lg;
}
-void cmGlobalUnixMakefileGenerator::EnableLanguagesFromGenerator(
- cmGlobalGenerator *gen, cmMakefile *mf)
+void cmGlobalUnixMakefileGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen)
{
- // for UNIX we just want to read in the configured files
- cmLocalGenerator *lg = this->CreateLocalGenerator();
-
- // set the Start directories
- lg->GetMakefile()->SetStartDirectory(m_CMakeInstance->GetStartDirectory());
- lg->GetMakefile()->SetStartOutputDirectory(m_CMakeInstance->GetStartOutputDirectory());
- lg->GetMakefile()->MakeStartDirectoriesCurrent();
-
+ this->SetConfiguredFilesPath(gen->GetCMakeInstance()->GetHomeOutputDirectory());
// if C, then enable C
if(gen->GetLanguageEnabled("C"))
{
- std::string fpath = mf->GetHomeOutputDirectory();
- fpath += "/CCMakeSystemConfig.cmake";
- lg->GetMakefile()->ReadListFile(0,fpath.c_str());
this->SetLanguageEnabled("C");
}
// if CXX
if(gen->GetLanguageEnabled("CXX"))
{
- std::string fpath = mf->GetHomeOutputDirectory();
- fpath += "/CXXCMakeSystemConfig.cmake";
- lg->GetMakefile()->ReadListFile(0,fpath.c_str());
this->SetLanguageEnabled("CXX");
}
- delete lg;
}
diff --git a/Source/cmGlobalUnixMakefileGenerator.h b/Source/cmGlobalUnixMakefileGenerator.h
index 21a9df2..895b6a1 100644
--- a/Source/cmGlobalUnixMakefileGenerator.h
+++ b/Source/cmGlobalUnixMakefileGenerator.h
@@ -44,7 +44,7 @@ public:
/**
* Try to determine system infomation, get it from another generator
*/
- virtual void EnableLanguagesFromGenerator(cmGlobalGenerator *, cmMakefile *);
+ virtual void EnableLanguagesFromGenerator(cmGlobalGenerator *);
};
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index aefec8e..406416b 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -106,7 +106,13 @@ bool cmIfCommand::InitialPass(std::vector<std::string> const& args)
if (!isValid)
{
- this->SetError("An IF command had incorrect arguments");
+ std::string err = "An IF command had incorrect arguments: ";
+ for(int i =0; i < args.size(); ++i)
+ {
+ err += args[i];
+ err += " ";
+ }
+ this->SetError(err.c_str());
return false;
}
@@ -177,6 +183,15 @@ bool cmIfCommand::IsTrue(const std::vector<std::string> &args, bool &isValid,
isValid = true;
}
+ if (args.size() == 2 && (args[0] == "MATCHES"))
+ {
+ if(!cmSystemTools::FileExists(args[1].c_str()))
+ {
+ isTrue = false;
+ }
+ isValid = true;
+ }
+
if (args.size() == 3 && (args[1] == "AND"))
{
def = makefile->GetDefinition(args[0].c_str());
@@ -263,7 +278,6 @@ bool cmIfCommand::IsTrue(const std::vector<std::string> &args, bool &isValid,
}
isValid = true;
}
-
return isTrue;
}
diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx
index 334a97f..d5a2f3a 100644
--- a/Source/cmLoadCommandCommand.cxx
+++ b/Source/cmLoadCommandCommand.cxx
@@ -176,7 +176,6 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& argsIn)
// the file must exist
std::string fullPath = cmDynamicLoader::LibPrefix();
fullPath += "cm" + argsIn[0] + cmDynamicLoader::LibExtension();
-
std::vector<std::string> args;
cmSystemTools::ExpandListArguments(argsIn, args);
@@ -196,7 +195,10 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& argsIn)
fullPath = cmSystemTools::FindFile(fullPath.c_str(), path);
if (fullPath == "")
{
- this->SetError("Attempt to load command failed.");
+ fullPath = "Attempt to load command failed from file : ";
+ fullPath += cmDynamicLoader::LibPrefix();
+ fullPath += "cm" + argsIn[0] + cmDynamicLoader::LibExtension();
+ this->SetError(fullPath.c_str());
return false;
}
diff --git a/Source/cmLocalUnixMakefileGenerator.cxx b/Source/cmLocalUnixMakefileGenerator.cxx
index b1279ca..e96f104 100644
--- a/Source/cmLocalUnixMakefileGenerator.cxx
+++ b/Source/cmLocalUnixMakefileGenerator.cxx
@@ -22,14 +22,13 @@
#include "cmMakeDepend.h"
#include "cmCacheManager.h"
#include "cmGeneratedFileStream.h"
+#include <stdio.h>
cmLocalUnixMakefileGenerator::cmLocalUnixMakefileGenerator()
- :m_SharedLibraryExtension("$(SHLIB_SUFFIX)"),
- m_ObjectFileExtension(".o"),
- m_ExecutableExtension(cmSystemTools::GetExecutableExtension()),
- m_StaticLibraryExtension(".a"),
- m_LibraryPrefix("lib")
{
+ m_WindowsShell = false;
+ m_IncludeDirective = "include";
+ m_MakefileVariableSize = 0;
}
cmLocalUnixMakefileGenerator::~cmLocalUnixMakefileGenerator()
@@ -203,8 +202,11 @@ void cmLocalUnixMakefileGenerator::OutputMakefile(const char* file,
fout << "# " << i->c_str() << "\n";
}
fout << "\n\n";
- fout << "# Suppresses display of executed commands\n";
- fout << ".SILENT:\n";
+ if(!m_Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"))
+ {
+ fout << "# Suppresses display of executed commands\n";
+ fout << ".SILENT:\n";
+ }
fout << "# disable some common implicit rules to speed things up\n";
fout << ".SUFFIXES:\n";
fout << ".SUFFIXES:.hpuxmakemusthaverule\n";
@@ -275,21 +277,33 @@ void cmLocalUnixMakefileGenerator::OutputMakefile(const char* file,
// only add the depend include if the depend file exists
if(cmSystemTools::FileExists(dependName.c_str()))
{
- this->OutputIncludeMakefile(fout, "cmake.depends");
+ fout << m_IncludeDirective << " cmake.depends\n";
}
}
-void cmLocalUnixMakefileGenerator::OutputIncludeMakefile(std::ostream& fout,
- const char* file)
-{
- fout << "include " << file << "\n";
-}
std::string
-cmLocalUnixMakefileGenerator::GetOutputExtension(const char*)
+cmLocalUnixMakefileGenerator::GetOutputExtension(const char* s)
{
- return m_ObjectFileExtension;
+ std::string sourceExtension = s;
+#if defined(_WIN32) && ! defined(__CYGWIN__)
+ if(sourceExtension == "def")
+ {
+ return "";
+ }
+ if(sourceExtension == "ico" || sourceExtension == "rc2")
+ {
+ return "";
+ }
+ if(sourceExtension == "rc")
+ {
+ return ".res";
+ }
+ return ".obj";
+#else
+ return ".o";
+#endif
}
@@ -306,24 +320,31 @@ void cmLocalUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
{
if (l->second.IsInAll())
{
- std::string path = m_LibraryOutputPath + m_LibraryPrefix;
+ std::string path = m_LibraryOutputPath;
if(l->second.GetType() == cmTarget::STATIC_LIBRARY)
{
- path = path + l->first + m_StaticLibraryExtension;
+ path +=
+ this->GetSafeDefinition("CMAKE_STATIC_LIBRARY_PREFIX") +
+ l->first
+ + this->GetSafeDefinition("CMAKE_STATIC_LIBRARY_SUFFIX");
fout << " \\\n"
<< cmSystemTools::ConvertToOutputPath(path.c_str());
}
else if(l->second.GetType() == cmTarget::SHARED_LIBRARY)
{
- path = path + l->first +
- m_Makefile->GetDefinition("CMAKE_SHLIB_SUFFIX");
+ path +=
+ this->GetSafeDefinition("CMAKE_SHARED_LIBRARY_PREFIX") +
+ l->first
+ + this->GetSafeDefinition("CMAKE_SHARED_LIBRARY_SUFFIX");
fout << " \\\n"
<< cmSystemTools::ConvertToOutputPath(path.c_str());
}
else if(l->second.GetType() == cmTarget::MODULE_LIBRARY)
{
- path = path + l->first +
- m_Makefile->GetDefinition("CMAKE_MODULE_SUFFIX");
+ path +=
+ this->GetSafeDefinition("CMAKE_SHARED_MODULE_PREFIX") +
+ l->first
+ + this->GetSafeDefinition("CMAKE_SHARED_MODULE_SUFFIX");
fout << " \\\n"
<< cmSystemTools::ConvertToOutputPath(path.c_str());
}
@@ -338,7 +359,7 @@ void cmLocalUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
l->second.IsInAll())
{
std::string path = m_ExecutableOutputPath + l->first +
- m_ExecutableExtension;
+ cmSystemTools::GetExecutableExtension();
fout << " \\\n" << cmSystemTools::ConvertToOutputPath(path.c_str());
}
}
@@ -366,10 +387,12 @@ void cmLocalUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
{
if(!(*i)->GetPropertyAsBool("HEADER_FILE_ONLY"))
{
- std::string outExt(this->GetOutputExtension((*i)->GetSourceExtension().c_str()));
+ std::string outExt(
+ this->GetOutputExtension((*i)->GetSourceExtension().c_str()));
if(outExt.size())
{
- fout << "\\\n" << cmSystemTools::ConvertToOutputPath((*i)->GetSourceName().c_str())
+ fout << "\\\n"
+ << cmSystemTools::ConvertToOutputPath((*i)->GetSourceName().c_str())
<< outExt.c_str() << " ";
}
}
@@ -441,38 +464,28 @@ void cmLocalUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
// and may have different flags
if( tgt.GetType() == cmTarget::EXECUTABLE)
{
- if(m_Makefile->GetDefinition("CMAKE_C_SHLIB_RUNTIME_FLAG"))
- {
- runtimeFlag = m_Makefile->GetDefinition("CMAKE_C_SHLIB_RUNTIME_FLAG");
- }
+ runtimeFlag = this->GetSafeDefinition("CMAKE_SHARED_LIBRARY_LINK_FLAGS");
}
else
{
- if(m_Makefile->GetDefinition("CMAKE_SHLIB_RUNTIME_FLAG"))
- {
- runtimeFlag = m_Makefile->GetDefinition("CMAKE_SHLIB_RUNTIME_FLAG");
- }
+ runtimeFlag = this->GetSafeDefinition("CMAKE_SHARED_LIBRARY_RUNTIME_FLAG");
}
- if(m_Makefile->GetDefinition("CMAKE_SHLIB_RUNTIME_SEP"))
- {
- runtimeSep = m_Makefile->GetDefinition("CMAKE_SHLIB_RUNTIME_SEP");
- }
+ runtimeSep = this->GetSafeDefinition("CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP");
}
else
- {
- if(m_Makefile->GetDefinition("CMAKE_CXX_SHLIB_RUNTIME_FLAG"))
+ {
+ if( tgt.GetType() == cmTarget::EXECUTABLE)
{
- runtimeFlag = m_Makefile->GetDefinition("CMAKE_CXX_SHLIB_RUNTIME_FLAG");
+ runtimeFlag = this->GetSafeDefinition("CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS");
}
-
- if(m_Makefile->GetDefinition("CMAKE_CXX_SHLIB_RUNTIME_SEP"))
+ else
{
- runtimeSep = m_Makefile->GetDefinition("CMAKE_CXX_SHLIB_RUNTIME_SEP");
- }
+ runtimeFlag = this->GetSafeDefinition("CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG");
+ }
+ runtimeFlag = this->GetSafeDefinition("CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG");
+ runtimeSep = this->GetSafeDefinition("CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP");
}
-
-
// concatenate all paths or no?
bool runtimeConcatenate = ( runtimeSep!="" );
if(runtimeFlag == "" || m_Makefile->IsOn("CMAKE_SKIP_RPATH") )
@@ -483,7 +496,8 @@ void cmLocalUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
// Some search paths should never be emitted
emitted.insert("");
emitted.insert("/usr/lib");
-
+ std::string libPathFlag = m_Makefile->GetDefinition("CMAKE_LIBRARY_PATH_FLAG");
+ std::string libLinkFlag = this->GetSafeDefinition("CMAKE_LINK_LIBRARY_FLAG");
// collect all the flags needed for linking libraries
std::string linkLibs;
const std::vector<std::string>& libdirs = tgt.GetLinkDirectories();
@@ -493,11 +507,11 @@ void cmLocalUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
std::string libpath = cmSystemTools::ConvertToOutputPath(libDir->c_str());
if(emitted.insert(libpath).second)
{
- std::string::size_type pos = libDir->find("-L");
+ std::string::size_type pos = libDir->find(libPathFlag.c_str());
if((pos == std::string::npos || pos > 0)
&& libDir->find("${") == std::string::npos)
{
- linkLibs += "-L";
+ linkLibs += libPathFlag;
if(outputRuntime)
{
runtimeDirs.push_back( libpath );
@@ -508,6 +522,11 @@ void cmLocalUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
}
}
+ std::string linkSuffix = this->GetSafeDefinition("CMAKE_LINK_LIBRARY_SUFFIX");
+ std::string regexp = ".*\\";
+ regexp += linkSuffix;
+ regexp += "$";
+ cmRegularExpression hasSuffix(linkSuffix.c_str());
std::string librariesLinked;
const cmTarget::LinkLibraries& libs = tgt.GetLinkLibraries();
for(cmTarget::LinkLibraries::const_iterator lib = libs.begin();
@@ -531,28 +550,37 @@ void cmLocalUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
std::string libpath = cmSystemTools::ConvertToOutputPath(dir.c_str());
if(emitted.insert(libpath).second)
{
- linkLibs += "-L";
+ linkLibs += libPathFlag;
linkLibs += libpath;
linkLibs += " ";
if(outputRuntime)
{
runtimeDirs.push_back( libpath );
}
- }
+ }
+ cmRegularExpression reg(regexp.c_str());
cmRegularExpression libname("lib(.*)(\\.so|\\.sl|\\.a|\\.dylib).*");
cmRegularExpression libname_noprefix("(.*)(\\.so|\\.sl|\\.a|\\.dylib).*");
if(libname.find(file))
{
- librariesLinked += "-l";
+ librariesLinked += libLinkFlag;
file = libname.match(1);
librariesLinked += file;
+ if(linkSuffix.size() && !hasSuffix.find(file))
+ {
+ librariesLinked += linkSuffix;
+ }
librariesLinked += " ";
}
else if(libname_noprefix.find(file))
{
- librariesLinked += "-l";
+ librariesLinked += libLinkFlag;
file = libname_noprefix.match(1);
librariesLinked += file;
+ if(linkSuffix.size() && !hasSuffix.find(file))
+ {
+ librariesLinked += linkSuffix;
+ }
librariesLinked += " ";
}
}
@@ -561,9 +589,13 @@ void cmLocalUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
{
if(!reg.find(lib->first))
{
- librariesLinked += "-l";
+ librariesLinked += libLinkFlag;
}
librariesLinked += lib->first;
+ if(linkSuffix.size() && !hasSuffix.find(lib->first))
+ {
+ librariesLinked += linkSuffix;
+ }
librariesLinked += " ";
}
}
@@ -593,6 +625,10 @@ void cmLocalUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
}
fout << " ";
}
+ if(m_Makefile->GetDefinition("CMAKE_STANDARD_LIBRARIES"))
+ {
+ fout << m_Makefile->GetDefinition("CMAKE_STANDARD_LIBRARIES") << " ";
+ }
}
@@ -624,91 +660,187 @@ std::string cmLocalUnixMakefileGenerator::CreateTargetRules(const cmTarget &targ
return customRuleCode;
}
+struct RuleVariables
+{
+ const char* replace;
+ const char* lookup;
+};
-void cmLocalUnixMakefileGenerator::OutputSharedLibraryRule(std::ostream& fout,
- const char* name,
- const cmTarget &t)
+static RuleVariables ruleReplaceVars[] =
{
- std::string target = m_LibraryOutputPath + "lib" + name + "$(SHLIB_SUFFIX)";
- std::string depend = "$(";
- depend += this->CreateMakeVariable(name, "_SRC_OBJS");
- depend += ") $(" + this->CreateMakeVariable(name, "_DEPEND_LIBS") + ")";
- std::string command = "$(RM) lib";
- command += name;
- command += "$(SHLIB_SUFFIX)";
- std::string command2;
- if(t.HasCxx())
+ {"<CMAKE_CXX_COMPILER>", "CMAKE_CXX_COMPILER"},
+ {"<CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS>", "CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS"},
+ {"<CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS>", "CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS"},
+ {"<CMAKE_CXX_LINK_FLAGS>", "CMAKE_CXX_LINK_FLAGS"},
+
+ {"<CMAKE_C_COMPILER>", "CMAKE_C_COMPILER"},
+ {"<CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS>", "CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS"},
+ {"<CMAKE_SHARED_MODULE_CREATE_C_FLAGS>", "CMAKE_SHARED_MODULE_CREATE_C_FLAGS"},
+ {"<CMAKE_C_LINK_FLAGS>", "CMAKE_C_LINK_FLAGS"},
+
+ {"<CMAKE_AR>", "CMAKE_AR"},
+ {"<CMAKE_RANLIB>", "CMAKE_RANLIB"},
+ {0}
+};
+
+
+
+
+void
+cmLocalUnixMakefileGenerator::ExpandRuleVariables(std::string& s,
+ const char* objects,
+ const char* target,
+ const char* linkLibs,
+ const char* source,
+ const char* object,
+ const char* flags,
+ const char* objectsquoted,
+ const char* targetBase)
+{
+ if(flags)
+ {
+ cmSystemTools::ReplaceString(s, "<FLAGS>", flags);
+ }
+
+ if(source)
{
- command2 = "$(CMAKE_CXX_LINK_SHARED) $(CMAKE_CXX_SHLIB_LINK_FLAGS) "
- "$(CMAKE_CXX_SHLIB_BUILD_FLAGS) $(CMAKE_CXX_FLAGS) -o \\\n";
+ cmSystemTools::ReplaceString(s, "<SOURCE>", source);
}
- else
+ if(object)
{
- command2 = "$(CMAKE_C_LINK_SHARED) $(CMAKE_SHLIB_LINK_FLAGS) "
- "$(CMAKE_SHLIB_BUILD_FLAGS) -o \\\n";
+ cmSystemTools::ReplaceString(s, "<OBJECT>", object);
}
- command2 += "\t ";
- std::string libName = m_LibraryOutputPath + "lib" + std::string(name) + "$(SHLIB_SUFFIX)";
- libName = cmSystemTools::ConvertToOutputPath(libName.c_str());
- command2 += libName + " \\\n";
- command2 += "\t $(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") ";
- cmOStringStream linklibs;
- this->OutputLinkLibraries(linklibs, name, t);
- command2 += linklibs.str();
+ if(objects)
+ {
+ cmSystemTools::ReplaceString(s, "<OBJECTS>", objects);
+ }
+ if(objectsquoted)
+ {
+ cmSystemTools::ReplaceString(s, "<OBJECTS_QUOTED>", objectsquoted);
+ }
+ if(target)
+ {
+ cmSystemTools::ReplaceString(s, "<TARGET>", target);
+ }
+ if(targetBase)
+ {
+ cmSystemTools::ReplaceString(s, "<TARGET_BASE>", targetBase);
+ }
+ if(linkLibs)
+ {
+ cmSystemTools::ReplaceString(s, "<LINK_LIBRARIES>", linkLibs);
+ }
+
+ RuleVariables* rv = ruleReplaceVars;
+ while(rv->replace)
+ {
+ cmSystemTools::ReplaceString(s, rv->replace,
+ this->GetSafeDefinition(rv->lookup));
+ rv++;
+ }
+}
+
+
+void cmLocalUnixMakefileGenerator::OutputLibraryRule(std::ostream& fout,
+ const char* name,
+ const cmTarget &t,
+ const char* prefix,
+ const char* suffix,
+ const char* createVariable,
+ const char* comment
+ )
+{
+ // create the library name
+ std::string targetNameBase = prefix;
+ targetNameBase += name;
+
+ std::string targetName = prefix;
+ targetName += name;
+ targetName += suffix;
+ // create the target full path name
+ std::string targetFullPath = m_LibraryOutputPath + targetName;
+ std::string targetBaseFullPath = m_LibraryOutputPath + targetNameBase;
+ targetBaseFullPath =
+ cmSystemTools::ConvertToOutputPath(targetBaseFullPath.c_str());
+ targetFullPath = cmSystemTools::ConvertToOutputPath(targetFullPath.c_str());
+ // get the objects that are used to link this library
+ std::string objs = "$(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") ";
+ std::string objsQuoted = "$(" + this->CreateMakeVariable(name, "_SRC_OBJS_QUOTED") + ") ";
+ // create a variable with the objects that this library depends on
+ std::string depend = objs + " $("
+ + this->CreateMakeVariable(name, "_DEPEND_LIBS") + ")";
+ // collect up the build rules
+ std::vector<std::string> rules;
+ std::string command = "$(RM) " + targetFullPath;
+ rules.push_back(command);
+ rules.push_back(m_Makefile->GetDefinition(createVariable));
+ // expand multi-command semi-colon separated lists
+ // of commands into separate commands
+ std::vector<std::string> commands;
+ cmSystemTools::ExpandListArguments(rules, commands);
+ // collect custom commands for this target and add them to the list
std::string customCommands = this->CreateTargetRules(t, name);
- const char* cc = 0;
if(customCommands.size() > 0)
{
- cc = customCommands.c_str();
+ commands.push_back(customCommands);
}
- this->OutputMakeRule(fout, "rules for a shared library",
- target.c_str(),
+ // collect up the link libraries
+ cmOStringStream linklibs;
+ this->OutputLinkLibraries(linklibs, name, t);
+ for(std::vector<std::string>::iterator i = commands.begin();
+ i != commands.end(); ++i)
+ {
+ this->ExpandRuleVariables(*i,
+ objs.c_str(),
+ targetFullPath.c_str(),
+ linklibs.str().c_str(),
+ 0, 0, 0, objsQuoted.c_str(),
+ targetBaseFullPath.c_str());
+ }
+ this->OutputMakeRule(fout, comment,
+ targetFullPath.c_str(),
depend.c_str(),
- command.c_str(),
- command2.c_str(),
- cc);
+ commands);
+}
+
+void cmLocalUnixMakefileGenerator::OutputSharedLibraryRule(std::ostream& fout,
+ const char* name,
+ const cmTarget &t)
+{
+ const char* createRule;
+ if(t.HasCxx())
+ {
+ createRule = "CMAKE_CXX_CREATE_SHARED_LIBRARY";
+ }
+ else
+ {
+ createRule = "CMAKE_C_CREATE_SHARED_LIBRARY";
+ }
+ this->OutputLibraryRule(fout, name, t,
+ this->GetSafeDefinition("CMAKE_SHARED_LIBRARY_PREFIX"),
+ this->GetSafeDefinition("CMAKE_SHARED_LIBRARY_SUFFIX"),
+ createRule,
+ "shared library");
}
void cmLocalUnixMakefileGenerator::OutputModuleLibraryRule(std::ostream& fout,
const char* name,
const cmTarget &t)
{
- std::string target = m_LibraryOutputPath + "lib" + std::string(name) + "$(MODULE_SUFFIX)";
- std::string depend = "$(";
- depend += this->CreateMakeVariable(name, "_SRC_OBJS")
- + ") $(" + this->CreateMakeVariable(name, "_DEPEND_LIBS") + ")";
- std::string command = "$(RM) lib" + std::string(name) + "$(MODULE_SUFFIX)";
- std::string command2;
+ const char* createRule;
if(t.HasCxx())
{
- command2 = "$(CMAKE_CXX_LINK_SHARED) $(CMAKE_CXX_MODULE_LINK_FLAGS) "
- "$(CMAKE_CXX_MODULE_BUILD_FLAGS) $(CMAKE_CXX_FLAGS) -o \\\n";
+ createRule = "CMAKE_CXX_CREATE_SHARED_MODULE";
}
else
{
- command2 = "$(CMAKE_C_LINK_SHARED) $(CMAKE_SHLIB_LINK_FLAGS) "
- "$(CMAKE_MODULE_BUILD_FLAGS) -o \\\n";
- }
- command2 += "\t ";
- std::string libName = m_LibraryOutputPath + "lib" + std::string(name) + "$(MODULE_SUFFIX)";
- libName = cmSystemTools::ConvertToOutputPath(libName.c_str());
- command2 += libName + " \\\n";
- command2 += "\t $(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") ";
- cmOStringStream linklibs;
- this->OutputLinkLibraries(linklibs, std::string(name).c_str(), t);
- command2 += linklibs.str();
- std::string customCommands = this->CreateTargetRules(t, name);
- const char* cc = 0;
- if(customCommands.size() > 0)
- {
- cc = customCommands.c_str();
+ createRule = "CMAKE_C_CREATE_SHARED_MODULE";
}
- this->OutputMakeRule(fout, "rules for a shared module library",
- target.c_str(),
- depend.c_str(),
- command.c_str(),
- command2.c_str(),
- cc);
+ this->OutputLibraryRule(fout, name, t,
+ this->GetSafeDefinition("CMAKE_SHARED_MODULE_PREFIX"),
+ this->GetSafeDefinition("CMAKE_SHARED_MODULE_SUFFIX"),
+ createRule,
+ "shared module");
}
@@ -716,81 +848,85 @@ void cmLocalUnixMakefileGenerator::OutputStaticLibraryRule(std::ostream& fout,
const char* name,
const cmTarget &t)
{
- std::string target = m_LibraryOutputPath + "lib" + std::string(name) + ".a";
- target = cmSystemTools::ConvertToOutputPath(target.c_str());
- std::string depend = "$(";
- depend += this->CreateMakeVariable(name, "_SRC_OBJS") + ")";
- std::string command;
+ const char* createRule;
if(t.HasCxx())
{
- command = "$(CMAKE_CXX_AR) $(CMAKE_CXX_AR_ARGS) ";
+ createRule = "CMAKE_CXX_CREATE_STATIC_LIBRARY";
}
else
{
- command = "$(CMAKE_AR) $(CMAKE_AR_ARGS) ";
- }
- command += target;
- command += " $(";
- command += this->CreateMakeVariable(name, "_SRC_OBJS") + ")";
- std::string command2 = "$(CMAKE_RANLIB) ";
- command2 += target;
- std::string comment = "rule to build static library: ";
- comment += name;
- std::string customCommands = this->CreateTargetRules(t, name);
- const char* cc = 0;
- if(customCommands.size() > 0)
- {
- cc = customCommands.c_str();
+ createRule = "CMAKE_C_CREATE_STATIC_LIBRARY";
}
- this->OutputMakeRule(fout,
- comment.c_str(),
- target.c_str(),
- depend.c_str(),
- command.c_str(),
- command2.c_str(),
- cc);
+ this->OutputLibraryRule(fout, name, t,
+ this->GetSafeDefinition("CMAKE_STATIC_LIBRARY_PREFIX"),
+ this->GetSafeDefinition("CMAKE_STATIC_LIBRARY_SUFFIX"),
+ createRule,
+ "static library");
+
}
void cmLocalUnixMakefileGenerator::OutputExecutableRule(std::ostream& fout,
const char* name,
const cmTarget &t)
{
- std::string target = m_ExecutableOutputPath + name + m_ExecutableExtension;
+ std::string flags;
+ std::string target = m_ExecutableOutputPath + name
+ + cmSystemTools::GetExecutableExtension();
+ std::string objs = "$(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") ";
std::string depend = "$(";
depend += this->CreateMakeVariable(name, "_SRC_OBJS")
+ ") $(" + this->CreateMakeVariable(name, "_DEPEND_LIBS") + ")";
- std::string command;
+ std::vector<std::string> rules;
if(t.HasCxx())
{
- command =
- "$(CMAKE_CXX_COMPILER) $(CMAKE_CXX_SHLIB_LINK_FLAGS) $(CMAKE_CXX_FLAGS) ";
+ rules.push_back(m_Makefile->GetDefinition("CMAKE_CXX_LINK_EXECUTABLE"));
+ flags += this->GetSafeDefinition("CMAKE_CXX_FLAGS");
+ flags += " ";
}
else
{
- command =
- "$(CMAKE_C_COMPILER) $(CMAKE_C_SHLIB_LINK_FLAGS) $(CMAKE_C_FLAGS) ";
+ rules.push_back(m_Makefile->GetDefinition("CMAKE_C_LINK_EXECUTABLE"));
+ flags += this->GetSafeDefinition("CMAKE_C_FLAGS");
+ flags += " ";
}
- command += "$(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") ";
cmOStringStream linklibs;
this->OutputLinkLibraries(linklibs, 0, t);
- command += linklibs.str();
- std::string outputFile = m_ExecutableOutputPath + name;
- command += " -o " + cmSystemTools::ConvertToOutputPath(outputFile.c_str());
- std::string comment = "rule to build executable: ";
- comment += name;
+ std::string comment = "executable";
+ std::vector<std::string> commands;
+ cmSystemTools::ExpandListArguments(rules, commands);
std::string customCommands = this->CreateTargetRules(t, name);
- const char* cc = 0;
if(customCommands.size() > 0)
{
- cc = customCommands.c_str();
+ commands.push_back(customCommands.c_str());
+ }
+ std::string linkFlags;
+ if(t.GetType() == cmTarget::WIN32_EXECUTABLE)
+ {
+ linkFlags += this->GetSafeDefinition("CMAKE_CREATE_WIN32_EXE");
+ linkFlags += " ";
+ }
+ else
+ {
+ linkFlags += this->GetSafeDefinition("CMAKE_CREATE_CONSOLE_EXE");
+ linkFlags += " ";
+ }
+
+ for(std::vector<std::string>::iterator i = commands.begin();
+ i != commands.end(); ++i)
+ {
+ cmSystemTools::ReplaceString(*i, "<LINK_FLAGS>", linkFlags.c_str());
+ this->ExpandRuleVariables(*i,
+ objs.c_str(),
+ target.c_str(),
+ linklibs.str().c_str(),
+ 0, 0, flags.c_str());
}
this->OutputMakeRule(fout,
comment.c_str(),
target.c_str(),
depend.c_str(),
- command.c_str(),
- cc);
+ commands);
}
@@ -805,8 +941,7 @@ void cmLocalUnixMakefileGenerator::OutputUtilityRule(std::ostream& fout,
{
cc = customCommands.c_str();
}
- std::string comment = "Rule to build Utility ";
- comment += name;
+ std::string comment = "Utility";
std::string depends;
std::string replaceVars;
const std::vector<cmCustomCommand> &ccs = t.GetCustomCommands();
@@ -953,20 +1088,25 @@ void cmLocalUnixMakefileGenerator::OutputDependLibs(std::ostream& fout)
// if it was a library..
if (libType)
{
- std::string library = m_LibraryPrefix;
- library += *lib;
+ std::string library;
std::string libpath = cacheValue;
if(libType && std::string(libType) == "SHARED")
{
- library += m_Makefile->GetDefinition("CMAKE_SHLIB_SUFFIX");
+ library = this->GetSafeDefinition("CMAKE_SHARED_LIBRARY_PREFIX");
+ library += *lib;
+ library += this->GetSafeDefinition("CMAKE_SHARED_LIBRARY_SUFFIX");
}
else if(libType && std::string(libType) == "MODULE")
{
- library += m_Makefile->GetDefinition("CMAKE_MODULE_SUFFIX");
+ library = this->GetSafeDefinition("CMAKE_SHARED_MODULE_PREFIX");
+ library += *lib;
+ library += this->GetSafeDefinition("CMAKE_SHARED_MODULE_SUFFIX");
}
else if(libType && std::string(libType) == "STATIC")
{
- library += m_StaticLibraryExtension;
+ library = this->GetSafeDefinition("CMAKE_STATIC_LIBRARY_PREFIX");
+ library += *lib;
+ library += this->GetSafeDefinition("CMAKE_STATIC_LIBRARY_SUFFIX");
}
else
{
@@ -1039,7 +1179,17 @@ void cmLocalUnixMakefileGenerator::OutputBuildTargetInDir(std::ostream& fout,
bool cmLocalUnixMakefileGenerator::SamePath(const char* path1, const char* path2)
{
- return strcmp(path1, path2) == 0;
+ if (strcmp(path1, path2) == 0)
+ {
+ return true;
+ }
+#if defined(_WIN32) || defined(__APPLE__)
+ return
+ cmSystemTools::LowerCase(this->ConvertToOutputForExisting(path1)) ==
+ cmSystemTools::LowerCase(this->ConvertToOutputForExisting(path2));
+#else
+ return false;
+#endif
}
void cmLocalUnixMakefileGenerator::OutputLibDepend(std::ostream& fout,
@@ -1060,38 +1210,39 @@ void cmLocalUnixMakefileGenerator::OutputLibDepend(std::ostream& fout,
if(m_LibraryOutputPath.size())
{
libpath = m_LibraryOutputPath;
- libpath += m_LibraryPrefix;
}
else
{
libpath = cacheValue;
libpath += "/";
- libpath += m_LibraryPrefix;
}
}
else
{
// library is in current Makefile so use lib as a prefix
libpath = m_LibraryOutputPath;
- libpath += m_LibraryPrefix;
}
- // add the library name
- libpath += name;
// add the correct extension
std::string ltname = name;
ltname += "_LIBRARY_TYPE";
const char* libType = m_Makefile->GetDefinition(ltname.c_str());
if(libType && std::string(libType) == "SHARED")
{
- libpath += m_Makefile->GetDefinition("CMAKE_SHLIB_SUFFIX");
+ libpath += this->GetSafeDefinition("CMAKE_SHARED_LIBRARY_PREFIX");
+ libpath += name;
+ libpath += this->GetSafeDefinition("CMAKE_SHARED_LIBRARY_SUFFIX");
}
else if (libType && std::string(libType) == "MODULE")
{
- libpath += m_Makefile->GetDefinition("CMAKE_MODULE_SUFFIX");
+ libpath += this->GetSafeDefinition("CMAKE_SHARED_MODULE_PREFIX");
+ libpath += name;
+ libpath += this->GetSafeDefinition("CMAKE_SHARED_MODULE_SUFFIX");
}
else if (libType && std::string(libType) == "STATIC")
{
- libpath += m_StaticLibraryExtension;
+ libpath += this->GetSafeDefinition("CMAKE_STATIC_LIBRARY_PREFIX");
+ libpath += name;
+ libpath += this->GetSafeDefinition("CMAKE_STATIC_LIBRARY_SUFFIX");
}
fout << cmSystemTools::ConvertToOutputPath(libpath.c_str()) << " ";
}
@@ -1131,7 +1282,7 @@ void cmLocalUnixMakefileGenerator::OutputExeDepend(std::ostream& fout,
// add the library name
exepath += name;
// add the correct extension
- exepath += m_ExecutableExtension;
+ exepath += cmSystemTools::GetExecutableExtension();
fout << cmSystemTools::ConvertToOutputPath(exepath.c_str()) << " ";
}
}
@@ -1160,12 +1311,50 @@ inline std::string FixDirectoryName(const char* dir)
}
+void cmLocalUnixMakefileGenerator::BuildInSubDirectoryWindows(std::ostream& fout,
+ const char* directory,
+ const char* target1,
+ const char* target2,
+ bool silent)
+{
+ if(target1)
+ {
+ std::string dir = cmSystemTools::ConvertToOutputPath(directory);
+ fout << "\tif not exist \"" << dir << "\\$(NULL)\""
+ << " "
+ << "$(MAKE) $(MAKESILENT) rebuild_cache\n";
+ if (!silent)
+ {
+ fout << "\techo " << directory << ": building " << target1 << "\n";
+ }
+ fout << "\tcd " << dir << "\n"
+ << "\t$(MAKE) -$(MAKEFLAGS) $(MAKESILENT) " << target1 << "\n";
+ }
+ if(target2)
+ {
+ if (!silent)
+ {
+ fout << "\techo " << directory << ": building " << target2 << "\n";
+ }
+ fout << "\t$(MAKE) -$(MAKEFLAGS) $(MAKESILENT) " << target2 << "\n";
+ }
+ std::string currentDir = m_Makefile->GetCurrentOutputDirectory();
+ fout << "\tcd " << cmSystemTools::ConvertToOutputPath(currentDir.c_str()) << "\n\n";
+}
+
+
void cmLocalUnixMakefileGenerator::BuildInSubDirectory(std::ostream& fout,
const char* dir,
const char* target1,
const char* target2,
bool silent)
{
+ if(m_WindowsShell)
+ {
+ this->BuildInSubDirectoryWindows(fout, dir, target1, target2, silent);
+ return;
+ }
+
std::string directory = cmSystemTools::ConvertToOutputPath(dir);
if(target1)
{
@@ -1313,7 +1502,9 @@ bool cmLocalUnixMakefileGenerator::OutputObjectDepends(std::ostream& fout)
(*source)->GetDepends().begin();
dep != (*source)->GetDepends().end(); ++dep)
{
- fout << (*source)->GetSourceName() << m_ObjectFileExtension << " : "
+ fout << (*source)->GetSourceName()
+ << this->GetOutputExtension(
+ (*source)->GetSourceExtension().c_str()) << " : "
<< cmSystemTools::ConvertToOutputPath(dep->c_str()) << "\n";
ret = true;
}
@@ -1511,69 +1702,65 @@ void cmLocalUnixMakefileGenerator::OutputCustomRules(std::ostream& fout)
}
}
+std::string
+cmLocalUnixMakefileGenerator::ConvertToOutputForExisting(const char* p)
+{
+ std::string ret = cmSystemTools::ConvertToOutputPath(p);
+ cmSystemTools::GetShortPath(ret.c_str(), ret);
+ return ret;
+}
+
+
void cmLocalUnixMakefileGenerator::OutputMakeVariables(std::ostream& fout)
{
const char* variables =
"# the standard shell for make\n"
"SHELL = /bin/sh\n"
- "\n"
- "CMAKE_RANLIB = @CMAKE_RANLIB@\n"
- "CMAKE_AR = @CMAKE_AR@\n"
- "CMAKE_AR_ARGS = @CMAKE_AR_ARGS@\n"
- "CMAKE_CXX_AR = @CMAKE_CXX_AR@\n"
- "CMAKE_CXX_AR_ARGS = @CMAKE_CXX_AR_ARGS@\n"
- "CMAKE_C_FLAGS = @CMAKE_C_FLAGS@\n"
- "CMAKE_C_COMPILER = @CMAKE_C_COMPILER@\n"
- "CMAKE_C_LINK_SHARED = @CMAKE_C_LINK_SHARED@\n"
- "CMAKE_CXX_LINK_SHARED = @CMAKE_CXX_LINK_SHARED@\n"
- "CMAKE_SHLIB_CFLAGS = @CMAKE_SHLIB_CFLAGS@\n"
-
- "CMAKE_CXX_SHLIB_CFLAGS = @CMAKE_CXX_SHLIB_CFLAGS@\n"
- "CMAKE_CXX_SHLIB_BUILD_FLAGS = @CMAKE_CXX_SHLIB_BUILD_FLAGS@\n"
- "CMAKE_CXX_SHLIB_LINK_FLAGS = @CMAKE_CXX_SHLIB_LINK_FLAGS@\n"
- "CMAKE_CXX_MODULE_BUILD_FLAGS = @CMAKE_CXX_MODULE_BUILD_FLAGS@\n"
- "CMAKE_CXX_MODULE_LINK_FLAGS = @CMAKE_CXX_MODULE_LINK_FLAGS@\n"
- "CMAKE_CXX_SHLIB_RUNTIME_FLAG = @CMAKE_CXX_SHLIB_RUNTIME_FLAG@\n"
- "CMAKE_CXX_SHLIB_RUNTIME_SEP = @CMAKE_CXX_SHLIB_RUNTIME_SEP@\n"
-
- "\n"
- "CMAKE_CXX_COMPILER = @CMAKE_CXX_COMPILER@\n"
- "CMAKE_CXX_FLAGS = @CMAKE_CXX_FLAGS@\n"
- "\n"
- "CMAKE_SHLIB_BUILD_FLAGS = @CMAKE_SHLIB_BUILD_FLAGS@\n"
- "CMAKE_SHLIB_LINK_FLAGS = @CMAKE_SHLIB_LINK_FLAGS@\n"
- "CMAKE_C_SHLIB_LINK_FLAGS = @CMAKE_C_SHLIB_LINK_FLAGS@\n"
- "CMAKE_MODULE_BUILD_FLAGS = @CMAKE_MODULE_BUILD_FLAGS@\n"
- "CMAKE_MODULE_LINK_FLAGS = @CMAKE_MODULE_LINK_FLAGS@\n"
- "CMAKE_C_SHLIB_RUNTIME_FLAG = @CMAKE_C_SHLIB_RUNTIME_FLAG@\n"
- "CMAKE_SHLIB_RUNTIME_FLAG = @CMAKE_SHLIB_RUNTIME_FLAG@\n"
- "CMAKE_SHLIB_RUNTIME_SEP = @CMAKE_SHLIB_RUNTIME_SEP@\n"
- "SHLIB_LD_LIBS = @CMAKE_SHLIB_LD_LIBS@\n"
- "SHLIB_SUFFIX = @CMAKE_SHLIB_SUFFIX@\n"
- "MODULE_SUFFIX = @CMAKE_MODULE_SUFFIX@\n"
- "RM = rm -f\n"
"\n";
- std::string replaceVars = variables;
- m_Makefile->ExpandVariablesInString(replaceVars);
- fout << replaceVars.c_str();
+ if(!m_WindowsShell)
+ {
+ fout << variables;
+ }
+ else
+ {
+ fout <<
+ "!IF \"$(OS)\" == \"Windows_NT\"\n"
+ "NULL=\n"
+ "!ELSE \n"
+ "NULL=nul\n"
+ "!ENDIF \n";
+ }
+ if(m_MakeSilentFlag.size())
+ {
+ fout << "MAKESILENT = " << m_MakeSilentFlag << "\n";
+ }
+
+ std::string cmakecommand = this->ConvertToOutputForExisting(
+ m_Makefile->GetDefinition("CMAKE_COMMAND"));
fout << "CMAKE_COMMAND = "
- << cmSystemTools::ConvertToOutputPath(m_Makefile->GetDefinition("CMAKE_COMMAND"))
+ << cmakecommand
<< "\n";
+ fout << "RM = " << cmakecommand.c_str() << " -E remove -f\n";
+
if(m_Makefile->GetDefinition("CMAKE_EDIT_COMMAND"))
{
fout << "CMAKE_EDIT_COMMAND = "
- << cmSystemTools::ConvertToOutputPath(m_Makefile->GetDefinition("CMAKE_EDIT_COMMAND"))
+ << this->ConvertToOutputForExisting(m_Makefile->GetDefinition("CMAKE_EDIT_COMMAND"))
<< "\n";
}
fout << "CMAKE_CURRENT_SOURCE = " <<
- cmSystemTools::ConvertToOutputPath(m_Makefile->GetStartDirectory()) << "\n";
+ cmSystemTools::ConvertToOutputPath(m_Makefile->GetStartDirectory())
+ << "\n";
fout << "CMAKE_CURRENT_BINARY = " <<
- cmSystemTools::ConvertToOutputPath(m_Makefile->GetStartOutputDirectory()) << "\n";
+ cmSystemTools::ConvertToOutputPath(m_Makefile->GetStartOutputDirectory())
+ << "\n";
fout << "CMAKE_SOURCE_DIR = " <<
- cmSystemTools::ConvertToOutputPath(m_Makefile->GetHomeDirectory()) << "\n";
+ cmSystemTools::ConvertToOutputPath(m_Makefile->GetHomeDirectory())
+ << "\n";
fout << "CMAKE_BINARY_DIR = " <<
- cmSystemTools::ConvertToOutputPath(m_Makefile->GetHomeOutputDirectory()) << "\n";
+ cmSystemTools::ConvertToOutputPath(m_Makefile->GetHomeOutputDirectory())
+ << "\n";
// Output Include paths
fout << "INCLUDE_FLAGS = ";
std::vector<std::string>& includes = m_Makefile->GetIncludeDirectories();
@@ -1740,12 +1927,12 @@ void cmLocalUnixMakefileGenerator::OutputInstallRules(std::ostream& fout)
void cmLocalUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
{
this->OutputMakeRule(fout,
- "Default build rule",
+ "default build rule",
"all",
"cmake.depends $(TARGETS) $(SUBDIR_BUILD)",
0);
this->OutputMakeRule(fout,
- "remove generated files",
+ "clean generated files",
"clean",
"$(SUBDIR_CLEAN)",
"-@ $(RM) $(CLEAN_OBJECT_FILES) "
@@ -1771,7 +1958,7 @@ void cmLocalUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
}
this->OutputMakeRule(fout,
- "Rule to build the cmake.depends and Makefile as side effect, if a source cmakelist file is out of date.",
+ "dependencies.",
"cmake.depends",
"$(CMAKE_MAKEFILE_SOURCES)",
"$(CMAKE_COMMAND) "
@@ -1779,7 +1966,7 @@ void cmLocalUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
"-H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)"
);
this->OutputMakeRule(fout,
- "Rule to build the cmake.check_depends and Makefile as side effect, if any source file has changed.",
+ "dependencies",
"cmake.check_depends",
allsources.c_str(),
"$(CMAKE_COMMAND) "
@@ -1788,15 +1975,14 @@ void cmLocalUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
);
this->OutputMakeRule(fout,
- "Rule to force the build of cmake.depends",
+ "dependencies",
"depend",
"$(SUBDIR_DEPEND)",
"$(CMAKE_COMMAND) "
"-S$(CMAKE_CURRENT_SOURCE) -O$(CMAKE_CURRENT_BINARY) "
"-H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)");
this->OutputMakeRule(fout,
- "Rule to force the build of cmake.depends "
- "in the current directory only.",
+ "dependencies",
"dependlocal",
0,
"$(CMAKE_COMMAND) "
@@ -1804,7 +1990,7 @@ void cmLocalUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
"-H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)");
this->OutputMakeRule(fout,
- "Rebuild CMakeCache.txt file",
+ "CMakeCache.txt",
"rebuild_cache",
"$(CMAKE_BINARY_DIR)/CMakeCache.txt",
"$(CMAKE_COMMAND) "
@@ -1814,7 +2000,7 @@ void cmLocalUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
if(m_Makefile->GetDefinition("CMAKE_EDIT_COMMAND"))
{
this->OutputMakeRule(fout,
- "Edit the CMakeCache.txt file with ccmake or CMakeSetup",
+ "edit CMakeCache.txt",
"edit_cache",
0,
"$(CMAKE_EDIT_COMMAND) "
@@ -1822,7 +2008,7 @@ void cmLocalUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
}
this->OutputMakeRule(fout,
- "Create CMakeCache.txt file",
+ "CMakeCache.txt",
"$(CMAKE_BINARY_DIR)/CMakeCache.txt",
0,
"$(CMAKE_COMMAND) "
@@ -1861,10 +2047,10 @@ void cmLocalUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
if (cmSystemTools::FileExists(ctest.c_str()))
{
this->OutputMakeRule(fout,
- "run any tests",
+ "tests",
"test",
"",
- cmSystemTools::ConvertToOutputPath(ctest.c_str()).c_str());
+ this->ConvertToOutputForExisting(ctest.c_str()).c_str());
}
}
@@ -1882,55 +2068,120 @@ OutputBuildObjectFromSource(std::ostream& fout,
return;
}
- std::string comment = "Build ";
- std::string objectFile = std::string(shortName) + m_ObjectFileExtension;
+ std::string comment = "object file";
+ std::string objectFile = std::string(shortName) +
+ this->GetOutputExtension(source.GetSourceExtension().c_str());
objectFile = cmSystemTools::ConvertToOutputPath(objectFile.c_str());
- comment += objectFile + " From ";
- comment += source.GetFullPath();
std::string compileCommand;
- cmSystemTools::e_FileFormat format =
+ cmSystemTools::FileFormat format =
cmSystemTools::GetFileFormat(source.GetSourceExtension().c_str());
- if( format == cmSystemTools::C_FILE_FORMAT )
+ std::vector<std::string> rules;
+ std::string flags;
+ if(extraCompileFlags)
{
- compileCommand = "$(CMAKE_C_COMPILER) $(CMAKE_C_FLAGS) ";
- compileCommand += extraCompileFlags;
- if(shared)
- {
- compileCommand += "$(CMAKE_SHLIB_CFLAGS) ";
- }
- compileCommand += "$(INCLUDE_FLAGS) -c ";
- compileCommand +=
- cmSystemTools::ConvertToOutputPath(source.GetFullPath().c_str());
- compileCommand += " -o ";
- compileCommand += objectFile;
+ flags += extraCompileFlags;
}
- else if ( format == cmSystemTools::CXX_FILE_FORMAT )
+ flags += "$(INCLUDE_FLAGS) ";
+ std::string sourceFile =
+ cmSystemTools::ConvertToOutputPath(source.GetFullPath().c_str());
+ std::string buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE");
+ buildType = cmSystemTools::UpperCase(buildType);
+ switch(format)
{
- compileCommand = "$(CMAKE_CXX_COMPILER) $(CMAKE_CXX_FLAGS) ";
- compileCommand += extraCompileFlags;
- if(shared)
+ case cmSystemTools::C_FILE_FORMAT:
{
- compileCommand += "$(CMAKE_SHLIB_CFLAGS) ";
+ rules.push_back(m_Makefile->GetDefinition("CMAKE_C_COMPILE_OBJECT"));
+ flags += this->GetSafeDefinition("CMAKE_C_FLAGS");
+ flags += " ";
+ if(shared)
+ {
+ flags += this->GetSafeDefinition("CMAKE_SHARED_LIBRARY_C_FLAGS");
+ flags += this->GetSafeDefinition("CMAKE_C_FLAGS");
+ flags += " ";
+ if(buildType.size())
+ {
+ std::string build = "CMAKE_C_FLAGS_";
+ build += buildType;
+ flags += this->GetSafeDefinition(build.c_str());
+ flags += " ";
+ }
+ }
+ break;
}
- compileCommand += "$(INCLUDE_FLAGS) -c ";
- compileCommand +=
- cmSystemTools::ConvertToOutputPath(source.GetFullPath().c_str());
- compileCommand += " -o ";
- compileCommand += objectFile;
+ case cmSystemTools::CXX_FILE_FORMAT:
+ {
+ rules.push_back(m_Makefile->GetDefinition("CMAKE_CXX_COMPILE_OBJECT"));
+ flags += this->GetSafeDefinition("CMAKE_CXX_FLAGS");
+ flags += " ";
+ if(buildType.size())
+ {
+ std::string build = "CMAKE_CXX_FLAGS_";
+ build += buildType;
+ flags += this->GetSafeDefinition(build.c_str());
+ flags += " ";
+ }
+ if(shared)
+ {
+ flags += this->GetSafeDefinition("CMAKE_SHARED_LIBRARY_CXX_FLAGS");
+ flags += " ";
+ }
+ break;
+ }
+ case cmSystemTools::HEADER_FILE_FORMAT:
+ return;
+ break;
+ case cmSystemTools::DEFINITION_FILE_FORMAT:
+ return;
+ break;
+ case cmSystemTools::RESOURCE_FILE_FORMAT:
+ {
+ flags = " $(INCLUDE_FLAGS) ";
+ // use rc rule here if it is defined
+ const char* rule = m_Makefile->GetDefinition("CMAKE_COMPILE_RESOURCE");
+ if(rule)
+ {
+ rules.push_back(rule);
+ }
+ }
+ break;
+ case cmSystemTools::NO_FILE_FORMAT:
+ case cmSystemTools::JAVA_FILE_FORMAT:
+ case cmSystemTools::STATIC_LIBRARY_FILE_FORMAT:
+ case cmSystemTools::SHARED_LIBRARY_FILE_FORMAT:
+ case cmSystemTools::MODULE_FILE_FORMAT:
+ case cmSystemTools::OBJECT_FILE_FORMAT:
+ case cmSystemTools::UNKNOWN_FILE_FORMAT:
+ cmSystemTools::Error("Unexpected file type ",
+ sourceFile.c_str());
+ break;
+ }
+ // expand multi-command semi-colon separated lists
+ // of commands into separate commands
+ std::vector<std::string> commands;
+ cmSystemTools::ExpandListArguments(rules, commands);
+ for(std::vector<std::string>::iterator i = commands.begin();
+ i != commands.end(); ++i)
+ {
+ this->ExpandRuleVariables(*i,
+ 0, // no objects
+ 0, // no target
+ 0, // no link libs
+ sourceFile.c_str(),
+ objectFile.c_str(),
+ flags.c_str() );
}
this->OutputMakeRule(fout,
comment.c_str(),
objectFile.c_str(),
- cmSystemTools::ConvertToOutputPath(source.GetFullPath().
- c_str()).c_str(),
- compileCommand.c_str());
+ sourceFile.c_str(),
+ commands);
}
void cmLocalUnixMakefileGenerator::OutputSourceObjectBuildRules(std::ostream& fout)
{
- fout << "# Rules to build " << m_ObjectFileExtension
+ fout << "# Rules to build " << this->GetOutputExtension("")
<< " files from their sources:\n";
std::set<std::string> rules;
@@ -2006,14 +2257,42 @@ void cmLocalUnixMakefileGenerator::OutputSourceObjectBuildRules(std::ostream& fo
}
}
+
void cmLocalUnixMakefileGenerator::OutputMakeRule(std::ostream& fout,
- const char* comment,
- const char* target,
- const char* depends,
- const char* command,
- const char* command2,
- const char* command3,
- const char* command4)
+ const char* comment,
+ const char* target,
+ const char* depends,
+ const char* command,
+ const char* command2,
+ const char* command3,
+ const char* command4)
+{
+ std::vector<std::string> commands;
+ if(command)
+ {
+ commands.push_back(command);
+ }
+ if(command2)
+ {
+ commands.push_back(command2);
+ }
+ if(command3)
+ {
+ commands.push_back(command3);
+ }
+ if(command4)
+ {
+ commands.push_back(command4);
+ }
+ this->OutputMakeRule(fout, comment, target, depends, commands);
+}
+
+
+void cmLocalUnixMakefileGenerator::OutputMakeRule(std::ostream& fout,
+ const char* comment,
+ const char* target,
+ const char* depends,
+ const std::vector<std::string>& commands)
{
if(!target)
{
@@ -2043,37 +2322,115 @@ void cmLocalUnixMakefileGenerator::OutputMakeRule(std::ostream& fout,
fout << replace.c_str();
}
fout << "\n";
-
- const char* commands[] = { command, command2, command3, command4 };
-
- for (unsigned int i = 0; i < sizeof(commands) / sizeof(commands[0]); ++i)
+ int count = 0;
+ for (std::vector<std::string>::const_iterator i = commands.begin();
+ i != commands.end(); ++i)
{
- if(commands[i])
+ replace = *i;
+ m_Makefile->ExpandVariablesInString(replace);
+ if(count == 0 && replace[0] != '-' && replace.find("echo") != 0
+ && replace.find("$(MAKE)") != 0)
{
- replace = commands[i];
- m_Makefile->ExpandVariablesInString(replace);
- if(replace[0] != '-' && replace.find("echo") != 0
- && replace.find("$(MAKE)") != 0)
+ std::string echostring = "Building ";
+ echostring += comment;
+ echostring += " ";
+ echostring += target;
+ echostring += "...";
+
+ // for unix we want to quote the output of echo
+ // for nmake and borland, the echo should not be quoted
+ if(strcmp(m_GlobalGenerator->GetName(), "Unix Makefiles") == 0)
{
- std::string echostring = replace;
- // for unix we want to quote the output of echo
- // for nmake and borland, the echo should not be quoted
- if(strcmp(m_GlobalGenerator->GetName(), "Unix Makefiles") == 0)
- {
- cmSystemTools::ReplaceString(echostring, "\\\n", " ");
- cmSystemTools::ReplaceString(echostring, " \t", " ");
- cmSystemTools::ReplaceString(echostring, "\n\t", "\"\n\techo \"");
- fout << "\techo \"" << echostring.c_str() << "\"\n";
- }
- else
- {
- cmSystemTools::ReplaceString(echostring, "\n\t", "\n\techo ");
- fout << "\techo " << echostring.c_str() << "\n";
- }
+ cmSystemTools::ReplaceString(echostring, "\\\n", " ");
+ cmSystemTools::ReplaceString(echostring, " \t", " ");
+ cmSystemTools::ReplaceString(echostring, "\n\t", "\"\n\techo \"");
+ fout << "\techo \"" << echostring.c_str() << "\"\n";
+ }
+ else
+ {
+ cmSystemTools::ReplaceString(echostring, "\n\t", "\n\techo ");
+ fout << "\techo " << echostring.c_str() << "\n";
}
- fout << "\t" << replace.c_str() << "\n";
}
+ fout << "\t" << replace.c_str() << "\n";
+ count++;
}
fout << "\n";
}
+const char* cmLocalUnixMakefileGenerator::GetSafeDefinition(const char* def)
+{
+ const char* ret = m_Makefile->GetDefinition(def);
+ if(!ret)
+ {
+ return "";
+ }
+ return ret;
+}
+
+std::string cmLocalUnixMakefileGenerator::LowerCasePath(const char* path)
+{
+#ifdef _WIN32
+ return cmSystemTools::LowerCase(path);
+#else
+ return std::string(path);
+#endif
+}
+
+std::string
+cmLocalUnixMakefileGenerator::CreateMakeVariable(const char* s, const char* s2)
+{
+ if(!m_MakefileVariableSize)
+ {
+ return std::string(s) + std::string(s2);
+ }
+ std::string unmodified = s;
+ unmodified += s2;
+ // see if th
+ std::map<cmStdString, cmStdString>::iterator i = m_MakeVariableMap.find(unmodified);
+ if(i != m_MakeVariableMap.end())
+ {
+ return i->second;
+ }
+ std::string ret = unmodified;
+ // if the string is greater the 32 chars it is an invalid vairable name
+ // for borland make
+ if(ret.size() > m_MakefileVariableSize)
+ {
+ int keep = m_MakefileVariableSize - 8;
+ int size = keep + 3;
+ std::string str1 = s;
+ std::string str2 = s2;
+ // we must shorten the combined string by 4 charactors
+ // keep no more than 24 charactors from the second string
+ if(str2.size() > keep)
+ {
+ str2 = str2.substr(0, keep);
+ }
+ if(str1.size() + str2.size() > size)
+ {
+ str1 = str1.substr(0, size - str2.size());
+ }
+ char buffer[5];
+ int i = 0;
+ sprintf(buffer, "%04d", i);
+ ret = str1 + str2 + buffer;
+ while(m_ShortMakeVariableMap.count(ret) && i < 1000)
+ {
+ ++i;
+ sprintf(buffer, "%04d", i);
+ ret = str1 + str2 + buffer;
+ }
+ if(i == 1000)
+ {
+ cmSystemTools::Error("Borland makefile varible length too long");
+ return unmodified;
+ }
+ // once an unused variable is found
+ m_ShortMakeVariableMap[ret] = "1";
+ }
+ // always make an entry into the unmodified to varible map
+ m_MakeVariableMap[unmodified] = ret;
+ return ret;
+
+}
diff --git a/Source/cmLocalUnixMakefileGenerator.h b/Source/cmLocalUnixMakefileGenerator.h
index 47fbafd..c441ace 100644
--- a/Source/cmLocalUnixMakefileGenerator.h
+++ b/Source/cmLocalUnixMakefileGenerator.h
@@ -60,12 +60,45 @@ public:
*/
virtual void OutputCheckDepends(std::ostream&);
+ /**
+ * Set to true if the shell being used is the windows shell.
+ * This controls if statements in the makefile and the SHELL variable.
+ * The default is false.
+ */
+ void SetWindowsShell(bool v) {m_WindowsShell = v;}
+
+ ///! Set the string used to include one makefile into another default is include.
+ void SetIncludeDirective(const char* s) { m_IncludeDirective = s; }
+
+ ///! Set the flag used to keep the make program silent.
+ void SetMakeSilentFlag(const char* s) { m_MakeSilentFlag = s; }
+
+ ///! Set max makefile variable size, default is 0 which means unlimited.
+ void SetMakefileVariableSize(int s) { m_MakefileVariableSize = s; }
+
protected:
+ virtual const char* GetSafeDefinition(const char*);
virtual void ProcessDepends(const cmMakeDepend &md);
virtual void OutputMakefile(const char* file, bool withDepends);
virtual void OutputTargetRules(std::ostream& fout);
virtual void OutputLinkLibraries(std::ostream&, const char* name, const cmTarget &);
-
+ void OutputLibraryRule(std::ostream& fout,
+ const char* name,
+ const cmTarget &t,
+ const char* prefix,
+ const char* suffix,
+ const char* createRule,
+ const char* comment
+ );
+ void ExpandRuleVariables(std::string& string,
+ const char* objects=0,
+ const char* target=0,
+ const char* linkLibs=0,
+ const char* source=0,
+ const char* object =0,
+ const char* flags = 0,
+ const char* objectsquoted = 0,
+ const char* targetBase = 0);
virtual void OutputSharedLibraryRule(std::ostream&, const char* name,
const cmTarget &);
virtual void OutputModuleLibraryRule(std::ostream&, const char* name,
@@ -99,6 +132,12 @@ protected:
const char* target2,
bool silent = false);
+ virtual void BuildInSubDirectoryWindows(std::ostream& fout,
+ const char* directory,
+ const char* target1,
+ const char* target2,
+ bool silent = false);
+
virtual void OutputSubDirectoryVars(std::ostream& fout,
const char* var,
const char* target,
@@ -113,6 +152,12 @@ protected:
const char* comment,
const char* target,
const char* depends,
+ const std::vector<std::string>& commands);
+
+ virtual void OutputMakeRule(std::ostream&,
+ const char* comment,
+ const char* target,
+ const char* depends,
const char* command,
const char* command2 = 0,
const char* command3 = 0,
@@ -125,33 +170,25 @@ protected:
///! return true if the two paths are the same
virtual bool SamePath(const char* path1, const char* path2);
virtual std::string GetOutputExtension(const char* sourceExtension);
- virtual void OutputIncludeMakefile(std::ostream&, const char* file);
- void SetObjectFileExtension(const char* e) { m_ObjectFileExtension = e;}
- void SetExecutableExtension(const char* e) { m_ExecutableExtension = e;}
- void SetStaticLibraryExtension(const char* e) {m_StaticLibraryExtension = e;}
- void SetSharedLibraryExtension(const char* e) {m_SharedLibraryExtension = e;}
- void SetLibraryPrefix(const char* e) { m_LibraryPrefix = e;}
std::string CreateTargetRules(const cmTarget &target,
const char* targetName);
- virtual std::string CreateMakeVariable(const char* s, const char* s2)
- {
- return std::string(s) + std::string(s2);
- }
+ virtual std::string CreateMakeVariable(const char* s, const char* s2);
///! if the OS is case insensitive then return a lower case of the path.
- virtual std::string LowerCasePath(const char* path)
- {
- return std::string(path);
- }
-
+ virtual std::string LowerCasePath(const char* path);
+
+ ///! for existing files convert to output path and short path if spaces
+ std::string ConvertToOutputForExisting(const char*);
protected:
+ int m_MakefileVariableSize;
+ std::map<cmStdString, cmStdString> m_MakeVariableMap;
+ std::map<cmStdString, cmStdString> m_ShortMakeVariableMap;
+
+ std::string m_IncludeDirective;
+ std::string m_MakeSilentFlag;
std::string m_ExecutableOutputPath;
std::string m_LibraryOutputPath;
- std::string m_SharedLibraryExtension;
- std::string m_ObjectFileExtension;
- std::string m_ExecutableExtension;
- std::string m_StaticLibraryExtension;
- std::string m_LibraryPrefix;
+ bool m_WindowsShell;
private:
};
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 2e97a83..bc8bf6b 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1403,8 +1403,7 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
cm.SetCacheArgs(*cmakeArgs);
}
// to save time we pass the EnableLanguage info directly
- gg->EnableLanguagesFromGenerator(m_LocalGenerator->GetGlobalGenerator(),
- this);
+ gg->EnableLanguagesFromGenerator(m_LocalGenerator->GetGlobalGenerator());
if (cm.Configure() != 0)
{
diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h
index d514ecf..ceab7fc 100644
--- a/Source/cmStandardIncludes.h
+++ b/Source/cmStandardIncludes.h
@@ -219,9 +219,9 @@ class cmIStringStream: private std::string, public std::istrstream
public:
typedef std::string StdString;
typedef std::istrstream IStrStream;
- cmIStringStream(): StdString(), IStrStream(this->StdString::c_str()) {}
+ cmIStringStream(): StdString(), IStrStream(StdString::c_str()) {}
cmIStringStream(const std::string& s):
- StdString(s), IStrStream(this->StdString::c_str()) {}
+ StdString(s), IStrStream(StdString::c_str()) {}
std::string str() const { return *this; }
void str(const std::string& s)
{
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 3a6c362..bec0575 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -124,7 +124,7 @@ cmSystemTools::GetTime(void)
#endif /* !HAVE_FTIME */
}
}
-
+bool cmSystemTools::s_RunCommandHideConsole = false;
bool cmSystemTools::s_DisableRunCommandOutput = false;
bool cmSystemTools::s_ErrorOccured = false;
bool cmSystemTools::s_DisableMessages = false;
@@ -251,10 +251,15 @@ void cmSystemTools::ReplaceString(std::string& source,
const char* replace,
const char* with)
{
+ // get out quick if string is not found
+ std::string::size_type start = source.find(replace);
+ if(start == std::string::npos)
+ {
+ return;
+ }
+ std::string rest;
std::string::size_type lengthReplace = strlen(replace);
std::string::size_type lengthWith = strlen(with);
- std::string rest;
- std::string::size_type start = source.find(replace);
while(start != std::string::npos)
{
rest = source.substr(start+lengthReplace);
@@ -1330,7 +1335,8 @@ bool RunCommandViaWin32(const char* command,
#if defined(__BORLANDC__)
return cmWin32ProcessExecution::BorlandRunCommand(command, dir, output,
retVal,
- verbose, timeout);
+ verbose, timeout,
+ cmSystemTools::GetRunCommandHideConsole());
#else // Visual studio
::SetLastError(ERROR_SUCCESS);
if ( ! command )
@@ -1338,13 +1344,13 @@ bool RunCommandViaWin32(const char* command,
cmSystemTools::Error("No command specified");
return false;
}
- //std::cout << "Command: " << command << std::endl;
- if ( dir )
- {
- //std::cout << "Dir: " << dir << std::endl;
- }
cmWin32ProcessExecution resProc;
+ if(cmSystemTools::GetRunCommandHideConsole())
+ {
+ resProc.SetHideWindows(true);
+ }
+
if ( cmSystemTools::GetWindows9xComspecSubstitute() )
{
resProc.SetConsoleSpawn(cmSystemTools::GetWindows9xComspecSubstitute() );
@@ -2367,7 +2373,7 @@ bool cmSystemTools::SimpleGlob(const std::string& glob,
return res;
}
-cmSystemTools::e_FileFormat cmSystemTools::GetFileFormat(const char* cext)
+cmSystemTools::FileFormat cmSystemTools::GetFileFormat(const char* cext)
{
if ( ! cext || *cext == 0 )
{
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 5218fa9..8d915ca 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -321,7 +321,7 @@ public:
/**
* Come constants for different file formats.
*/
- enum e_FileFormat {
+ enum FileFormat {
NO_FILE_FORMAT = 0,
C_FILE_FORMAT,
CXX_FILE_FORMAT,
@@ -339,7 +339,7 @@ public:
/**
* Determine the file type based on the extension
*/
- static e_FileFormat GetFileFormat(const char* ext);
+ static FileFormat GetFileFormat(const char* ext);
/**
* On Windows 9x we need a comspec (command.com) substitute to run
@@ -349,6 +349,11 @@ public:
static void SetWindows9xComspecSubstitute(const char*);
static const char* GetWindows9xComspecSubstitute();
+ /** Windows if this is true, the CreateProcess in RunCommand will
+ * not show new consol windows when running programs.
+ */
+ static void SetRunCommandHideConsole(bool v){s_RunCommandHideConsole = v;}
+ static bool GetRunCommandHideConsole(){ return s_RunCommandHideConsole;}
protected:
// these two functions can be called from ConvertToOutputPath
/**
@@ -366,6 +371,7 @@ protected:
static std::string ConvertToWindowsOutputPath(const char*);
private:
+ static bool s_RunCommandHideConsole;
static bool s_ErrorOccured;
static bool s_DisableMessages;
static bool s_DisableRunCommandOutput;
diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx
index f56829a..b187182 100644
--- a/Source/cmTryCompileCommand.cxx
+++ b/Source/cmTryCompileCommand.cxx
@@ -135,7 +135,7 @@ int cmTryCompileCommand::CoreTryCompileCode(
}
std::string source = argv[2];
- cmSystemTools::e_FileFormat format =
+ cmSystemTools::FileFormat format =
cmSystemTools::GetFileFormat(
cmSystemTools::GetFilenameExtension(source).c_str());
if ( format == cmSystemTools::C_FILE_FORMAT )
diff --git a/Source/cmWin32ProcessExecution.cxx b/Source/cmWin32ProcessExecution.cxx
index e56f0f3..9c38781 100644
--- a/Source/cmWin32ProcessExecution.cxx
+++ b/Source/cmWin32ProcessExecution.cxx
@@ -110,7 +110,7 @@ inline bool IsWinNT()
//---------------------------------------------------------------------------
bool cmWin32ProcessExecution::BorlandRunCommand(
const char* command, const char* dir,
- std::string& output, int& retVal, bool verbose, int /* timeout */)
+ std::string& output, int& retVal, bool verbose, int /* timeout */, bool hideWindows)
{
//verbose = true;
//std::cerr << std::endl
@@ -170,7 +170,11 @@ bool cmWin32ProcessExecution::BorlandRunCommand(
si.dwFlags = STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
si.hStdOutput = newstdout;
si.hStdError = newstdout;
- si.wShowWindow = SW_SHOWDEFAULT; // SW_HIDE;
+ si.wShowWindow = SW_SHOWDEFAULT;
+ if(hideWindows)
+ {
+ si.wShowWindow = SW_HIDE;
+ }
//set the new handles for the child process si.hStdInput = newstdin;
char* commandAndArgs = strcpy(new char[strlen(command)+1], command);
@@ -285,7 +289,8 @@ static BOOL RealPopenCreateProcess(const char *cmdstring,
HANDLE hStdin,
HANDLE hStdout,
HANDLE hStderr,
- HANDLE *hProcess)
+ HANDLE *hProcess,
+ bool hideWindows)
{
PROCESS_INFORMATION piProcInfo;
STARTUPINFO siStartInfo;
@@ -404,7 +409,11 @@ static BOOL RealPopenCreateProcess(const char *cmdstring,
siStartInfo.hStdInput = hStdin;
siStartInfo.hStdOutput = hStdout;
siStartInfo.hStdError = hStderr;
- siStartInfo.wShowWindow = SW_SHOWDEFAULT; // SW_HIDE;
+ siStartInfo.wShowWindow = SW_SHOWDEFAULT;
+ if(hideWindows)
+ {
+ siStartInfo.wShowWindow = SW_HIDE;
+ }
//std::cout << "Create process: " << s2 << std::endl;
if (CreateProcess(NULL,
@@ -617,7 +626,7 @@ bool cmWin32ProcessExecution::PrivateOpen(const char *cmdstring,
hChildStdinRd,
hChildStdoutWr,
hChildStdoutWr,
- &hProcess))
+ &hProcess, m_HideWindows))
return NULL;
}
else
@@ -628,7 +637,7 @@ bool cmWin32ProcessExecution::PrivateOpen(const char *cmdstring,
hChildStdinRd,
hChildStdoutWr,
hChildStderrWr,
- &hProcess))
+ &hProcess, m_HideWindows))
return NULL;
}
diff --git a/Source/cmWin32ProcessExecution.h b/Source/cmWin32ProcessExecution.h
index 6dec659..ea38768 100644
--- a/Source/cmWin32ProcessExecution.h
+++ b/Source/cmWin32ProcessExecution.h
@@ -45,10 +45,13 @@ class cmWin32ProcessExecution
public:
cmWin32ProcessExecution()
{
+ m_HideWindows = false;
this->SetConsoleSpawn("w9xpopen.exe");
this->Initialize();
}
-
+ ///! If true windows will be created hidden.
+ void SetHideWindows(bool v) { m_HideWindows = v; }
+
/**
* Initialize the process execution datastructure. Do not call while
* running the process.
@@ -133,7 +136,7 @@ public:
*/
static bool BorlandRunCommand(const char* command, const char* dir,
std::string& output, int& retVal, bool verbose,
- int timeout);
+ int timeout, bool hideWindows);
private:
bool PrivateOpen(const char*, const char*, int, int);
@@ -156,6 +159,7 @@ private:
std::string m_Output;
std::string m_ConsoleSpawn;
bool m_Verbose;
+ bool m_HideWindows;
};
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index d17ce2c..5f4dd6b 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -195,6 +195,10 @@ void ctest::Initialize()
fin.getline(buffer, 1023);
buffer[1023] = 0;
std::string line = ::CleanString(buffer);
+ if(line.size() == 0)
+ {
+ continue;
+ }
while ( fin && (line[line.size()-1] == '\\') )
{
line = line.substr(0, line.size()-1);
@@ -207,10 +211,6 @@ void ctest::Initialize()
{
continue;
}
- if ( line.size() == 0 )
- {
- continue;
- }
std::string::size_type cpos = line.find_first_of(":");
if ( cpos == line.npos )
{