summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2001-11-15 22:11:26 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2001-11-15 22:11:26 (GMT)
commit407afb906c6f3627d14acd959fb518d16caa5d7b (patch)
treed54bf9fbdaceddb600e45c262aab4f8c8b400c20
parenta6f5f8395ce28d50f28ce322f53c4390214ff956 (diff)
downloadCMake-407afb906c6f3627d14acd959fb518d16caa5d7b.zip
CMake-407afb906c6f3627d14acd959fb518d16caa5d7b.tar.gz
CMake-407afb906c6f3627d14acd959fb518d16caa5d7b.tar.bz2
closer to nmake working, added CMAKE_MAKE_COMMAND instead of MAKECOMMAND used by Dart, nmake makefiles work with borland make and nmake
-rw-r--r--Modules/Dart.cmake12
-rw-r--r--Source/cmBuildCommand.cxx6
-rw-r--r--Source/cmNMakeMakefileGenerator.cxx51
-rw-r--r--Source/cmNMakeMakefileGenerator.h2
-rw-r--r--Source/cmUnixMakefileGenerator.cxx25
-rw-r--r--Source/cmUnixMakefileGenerator.h2
-rw-r--r--Templates/CMakeNMakeWindowsSystemConfig.cmake2
-rw-r--r--Templates/CMakeSystemConfig.cmake.in1
-rw-r--r--Templates/CMakeWindowsBorlandConfig.cmake1
-rw-r--r--Templates/CMakeWindowsSystemConfig.cmake1
10 files changed, 84 insertions, 19 deletions
diff --git a/Modules/Dart.cmake b/Modules/Dart.cmake
index ba0d9f4..957ff4d 100644
--- a/Modules/Dart.cmake
+++ b/Modules/Dart.cmake
@@ -24,15 +24,9 @@ IF(BUILD_TESTING)
# the project must have a DartConfig.cmake file
INCLUDE(${PROJECT_SOURCE_DIR}/DartConfig.cmake)
- # find programs used by testing
- # look for the make program
- IF( BCB_BIN_PATH )
- FIND_PROGRAM(MAKEPROGRAM make ${BCB_BIN_PATH} )
- ENDIF( BCB_BIN_PATH )
- IF(NOT UNIX)
- FIND_PROGRAM(MAKEPROGRAM msdev )
- ENDIF(NOT UNIX)
- FIND_PROGRAM(MAKEPROGRAM NAMES gmake make )
+ # make program just needs to use CMAKE_MAKE_PROGRAM which is required
+ # to be defined by cmake
+ SET(MAKEPROGRAM ${CMAKE_MAKE_PROGRAM})
FIND_PROGRAM(CVSCOMMAND cvs )
FIND_PROGRAM(COMPRESSIONCOMMAND NAMES gzip compress zip )
FIND_PROGRAM(GUNZIPCOMMAND gunzip )
diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx
index 18037b4..a778883 100644
--- a/Source/cmBuildCommand.cxx
+++ b/Source/cmBuildCommand.cxx
@@ -58,6 +58,7 @@ bool cmBuildCommand::InitialPass(std::vector<std::string> const& args)
std::string makecommand;
std::string makeprogram = args[1];
m_Makefile->ExpandVariablesInString(makeprogram);
+ std::string compiler = m_Makefile->GetDefinition("CMAKE_CXX_COMPILER");
if(makeprogram.find("msdev") != std::string::npos ||
makeprogram.find("MSDEV") != std::string::npos )
{
@@ -70,10 +71,11 @@ bool cmBuildCommand::InitialPass(std::vector<std::string> const& args)
}
else if(makeprogram.find("Borland") != std::string::npos ||
makeprogram.find("BORLAND") != std::string::npos ||
- makeprogram.find("borland") != std::string::npos)
+ makeprogram.find("borland") != std::string::npos ||
+ compiler.find("Borland") != std::string::npos)
{
makecommand = makeprogram;
- makecommand += " -K";
+ makecommand += " -i";
}
else
{
diff --git a/Source/cmNMakeMakefileGenerator.cxx b/Source/cmNMakeMakefileGenerator.cxx
index 0964326..00e90f6 100644
--- a/Source/cmNMakeMakefileGenerator.cxx
+++ b/Source/cmNMakeMakefileGenerator.cxx
@@ -137,7 +137,7 @@ void cmNMakeMakefileGenerator::BuildInSubDirectory(std::ostream& fout,
cmSystemTools::ConvertToWindowsSlashes(dir);
fout << "\tif not exist " << dir.c_str() << " "
<< "$(MAKE) rebuild_cache\n"
- << "\tcd \".\\" << directory << "\"\n"
+ << "\tcd .\\" << directory << "\n"
<< "\t$(MAKE) -$(MAKEFLAGS) " << target1 << "\n";
}
if(target2)
@@ -146,7 +146,7 @@ void cmNMakeMakefileGenerator::BuildInSubDirectory(std::ostream& fout,
}
std::string currentDir = m_Makefile->GetCurrentOutputDirectory();
cmSystemTools::ConvertToWindowsSlashes(currentDir);
- fout << "\tcd \"" << currentDir.c_str() << "\"\n";
+ fout << "\tcd " << currentDir.c_str() << "\n";
}
// This needs to be overriden because nmake requires commands to be quoted
@@ -235,11 +235,15 @@ OutputBuildObjectFromSource(std::ostream& fout,
bool shared)
{
std::string comment = "Build ";
- std::string objectFile = std::string(shortName) + ".obj";
+ std::string objectFile = std::string(shortName) +
+ this->GetOutputExtension(source.GetSourceExtension().c_str());
+ std::cerr << "short name objectfile " << objectFile.c_str() << " " << shortName << "\n";
+
comment += objectFile + " From ";
comment += source.GetFullPath();
std::string compileCommand;
std::string ext = source.GetSourceExtension();
+ std::cerr << "ext " << ext.c_str() << "\n";
if(ext == "c" )
{
compileCommand = "$(CMAKE_C_COMPILER) $(CMAKE_CFLAGS) ";
@@ -255,12 +259,23 @@ OutputBuildObjectFromSource(std::ostream& fout,
}
else if (ext == "rc")
{
- std::cerr << "rc file " << source.GetFullPath() << "\n";
+ compileCommand = "$(RC) /fo\"";
+ compileCommand += objectFile;
+ compileCommand += "\" ";
+ compileCommand += source.GetFullPath();
}
else if (ext == "def")
{
std::cerr << "def file " << source.GetFullPath() << "\n";
}
+ else if (ext == "ico")
+ {
+ std::cerr << "ico file " << source.GetFullPath() << "\n";
+ }
+ else if (ext == "rc2")
+ {
+ std::cerr << "rc2 file " << source.GetFullPath() << "\n";
+ }
// assume c++ if not c rc or def
else
{
@@ -348,6 +363,11 @@ void cmNMakeMakefileGenerator::OutputExecutableRule(std::ostream& fout,
command += "$(" + std::string(name) + "_SRC_OBJS) ";
command += " /Fe" + m_ExecutableOutputPath + name;
command += ".exe /link ";
+ if(t.GetType() == cmTarget::WIN32_EXECUTABLE)
+ {
+ command += " /subsystem:windows ";
+ }
+
std::strstream linklibs;
this->OutputLinkLibraries(linklibs, 0, t);
linklibs << std::ends;
@@ -412,3 +432,26 @@ void cmNMakeMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
fout << linkLibs << "$(CMAKE_STANDARD_WINDOWS_LIBRARIES) ";
}
}
+
+
+std::string cmNMakeMakefileGenerator::GetOutputExtension(const char* s)
+{
+ std::string sourceExtension = s;
+ if(sourceExtension == "def" || sourceExtension == "ico" || sourceExtension == "rc2")
+ {
+ return "";
+ }
+ if(sourceExtension == "rc")
+ {
+ return ".res";
+ }
+ return ".obj";
+}
+
+
+void cmNMakeMakefileGenerator::OutputIncludeMakefile(std::ostream& fout,
+ const char* file)
+{
+ fout << "!include " << file << "\n";
+}
+
diff --git a/Source/cmNMakeMakefileGenerator.h b/Source/cmNMakeMakefileGenerator.h
index 7249e87..eb874d0 100644
--- a/Source/cmNMakeMakefileGenerator.h
+++ b/Source/cmNMakeMakefileGenerator.h
@@ -98,6 +98,8 @@ protected:
virtual void OutputLinkLibraries(std::ostream& fout,
const char* targetLibrary,
const cmTarget &tgt);
+ virtual std::string GetOutputExtension(const char* sourceExtension);
+ virtual void OutputIncludeMakefile(std::ostream&, const char* file);
private:
bool m_QuoteNextCommand; // if this is true, OutputMakeRule
// will not quote the next commands
diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx
index 723b964..399e6c9 100644
--- a/Source/cmUnixMakefileGenerator.cxx
+++ b/Source/cmUnixMakefileGenerator.cxx
@@ -271,10 +271,23 @@ void cmUnixMakefileGenerator::OutputMakefile(const char* file)
// only add the depend include if the depend file exists
if(cmSystemTools::FileExists(dependName.c_str()))
{
- fout << "include cmake.depends\n";
+ this->OutputIncludeMakefile(fout, "cmake.depends");
}
}
+void cmUnixMakefileGenerator::OutputIncludeMakefile(std::ostream& fout,
+ const char* file)
+{
+ fout << "include " << file << "\n";
+}
+
+
+std::string
+cmUnixMakefileGenerator::GetOutputExtension(const char* sourceExtension)
+{
+ return m_ObjectFileExtension;
+}
+
// Output the rules for any targets
@@ -345,9 +358,13 @@ void cmUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
{
if(!i->IsAHeaderFileOnly())
{
- fout << "\\\n" << i->GetSourceName()
- << m_ObjectFileExtension << " ";
- }
+ std::string outExt(this->GetOutputExtension(i->GetSourceExtension().c_str()));
+ if(outExt.size())
+ {
+ fout << "\\\n" << i->GetSourceName()
+ << outExt.c_str() << " ";
+ }
+ }
}
fout << "\n\n";
}
diff --git a/Source/cmUnixMakefileGenerator.h b/Source/cmUnixMakefileGenerator.h
index b30d6b9..abdf71e 100644
--- a/Source/cmUnixMakefileGenerator.h
+++ b/Source/cmUnixMakefileGenerator.h
@@ -151,6 +151,8 @@ protected:
const char* command2 = 0,
const char* command3 = 0,
const char* command4 = 0);
+ 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;}
diff --git a/Templates/CMakeNMakeWindowsSystemConfig.cmake b/Templates/CMakeNMakeWindowsSystemConfig.cmake
index 9136109..0019f1e 100644
--- a/Templates/CMakeNMakeWindowsSystemConfig.cmake
+++ b/Templates/CMakeNMakeWindowsSystemConfig.cmake
@@ -24,6 +24,8 @@ SET (CMAKE_USE_WIN32_THREADS 1 CACHE BOOL "Use the win32 thread library")
SET (CMAKE_STANDARD_WINDOWS_LIBRARIES "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib" CACHE STRING "Libraries linked by defalut with all applications")
SET (CMAKE_SHLIB_SUFFIX ".dll" CACHE STRING "Shared library suffix")
SET (CMAKE_MODULE_SUFFIX ".dll" CACHE STRING "Module library suffix")
+SET (CMAKE_MAKE_PROGRAM "nmake" CACHE STRING "Program used to build from makefiles.")
+
diff --git a/Templates/CMakeSystemConfig.cmake.in b/Templates/CMakeSystemConfig.cmake.in
index 03c329a..f42ee0d 100644
--- a/Templates/CMakeSystemConfig.cmake.in
+++ b/Templates/CMakeSystemConfig.cmake.in
@@ -63,4 +63,5 @@ SET (CMAKE_COMPILER_IS_GNUCXX @CMAKE_COMPILER_IS_GNUCXX@ CACHE INTERNAL "Is
SET (CMAKE_ANSI_CFLAGS @CMAKE_ANSI_CFLAGS@ CACHE INTERNAL "What flags are required by the c++ compiler to make it ansi.")
SET (CMAKE_ANSI_CXXFLAGS @CMAKE_ANSI_CXXFLAGS@ CACHE INTERNAL "What flags are required by the c++ compiler to make it ansi.")
SET (CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION @CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION@ CACHE INTERNAL "does the compiler not support explicit template instantiation.")
+FIND_PROGRAM(CMAKE_MAKE_PROGRAM NAMES gmake make )
diff --git a/Templates/CMakeWindowsBorlandConfig.cmake b/Templates/CMakeWindowsBorlandConfig.cmake
index 1b2bf2b..86e8ca8d 100644
--- a/Templates/CMakeWindowsBorlandConfig.cmake
+++ b/Templates/CMakeWindowsBorlandConfig.cmake
@@ -94,3 +94,4 @@ IF (NOT DEFS_SYS)
SET (DEFS_SYS "-DWIN32;WIN32_LEAN_AND_MEAN;STRICT;_RTLDLL;USEPACKAGES" CACHE STRING "Compiler conditional defines required for correct compilation")
ENDIF (NOT DEFS_SYS)
+FIND_PROGRAM(CMAKE_MAKE_PROGRAM make ${BCB_BIN_PATH} )
diff --git a/Templates/CMakeWindowsSystemConfig.cmake b/Templates/CMakeWindowsSystemConfig.cmake
index 895a8b5..2e59adf 100644
--- a/Templates/CMakeWindowsSystemConfig.cmake
+++ b/Templates/CMakeWindowsSystemConfig.cmake
@@ -15,3 +15,4 @@ SET (CMAKE_CXX_FLAGS_DEBUG "/MDd /Zi /Od /GZ" CACHE STRING
SET (CMAKE_CXX_FLAGS "/W3 /Zm1000 /GX /GR" CACHE STRING
"Flags used by the compiler during all build types, /GX /GR are for exceptions and rtti in VC++, /Zm1000 increases the compiler's memory allocation to support ANSI C++/stdlib")
SET (CMAKE_USE_WIN32_THREADS 1 CACHE BOOL "Use the win32 thread library")
+SET (CMAKE_MAKE_PROGRAM "msdev" CACHE STRING "Program used to build from dsp files.") \ No newline at end of file