diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2003-08-21 20:22:23 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2003-08-21 20:22:23 (GMT) |
commit | a413160fecc73bf61fccff9b74d6e18349eeb861 (patch) | |
tree | 5cbc485d7850ebc5200d8f094ba1559b1bc202e8 /Source | |
parent | 0270b60b8f32c0da9bbe66ebee6aea92ab177c3c (diff) | |
download | CMake-a413160fecc73bf61fccff9b74d6e18349eeb861.zip CMake-a413160fecc73bf61fccff9b74d6e18349eeb861.tar.gz CMake-a413160fecc73bf61fccff9b74d6e18349eeb861.tar.bz2 |
ENH: add the unix makefile generator as an option from the windows GUI, this builds with mingw, cygwin, and combinations of make cl, bcc32
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeLists.txt | 45 | ||||
-rw-r--r-- | Source/CTest/Curl/telnet.c | 2 | ||||
-rw-r--r-- | Source/cmDynamicLoader.cxx | 2 | ||||
-rw-r--r-- | Source/cmGlobalBorlandMakefileGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 3 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmGlobalNMakeMakefileGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/cmGlobalUnixMakefileGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 15 | ||||
-rw-r--r-- | Source/cmSystemTools.h | 8 | ||||
-rw-r--r-- | Source/cmWin32ProcessExecution.cxx | 26 | ||||
-rw-r--r-- | Source/cmake.cxx | 19 | ||||
-rw-r--r-- | Source/kwsys/SystemTools.cxx | 2 |
14 files changed, 96 insertions, 34 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 35de882..b06883a 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -65,22 +65,25 @@ ENDIF (APPLE) IF (WIN32) IF(NOT UNIX) SET(SRCS ${SRCS} - cmGlobalBorlandMakefileGenerator.cxx - cmGlobalNMakeMakefileGenerator.cxx - cmGlobalVisualStudio6Generator.cxx - cmLocalVisualStudio6Generator.cxx - cmGlobalVisualStudio71Generator.cxx - cmGlobalVisualStudio7Generator.cxx - cmLocalVisualStudio7Generator.cxx - cmGlobalBorlandMakefileGenerator.h - cmGlobalNMakeMakefileGenerator.h - cmGlobalVisualStudio6Generator.h - cmLocalVisualStudio6Generator.h - cmGlobalVisualStudio7Generator.h - cmLocalVisualStudio7Generator.h - cmWin32ProcessExecution.cxx - cmWin32ProcessExecution.h - ) + cmGlobalBorlandMakefileGenerator.cxx + cmGlobalNMakeMakefileGenerator.cxx + cmGlobalVisualStudio6Generator.cxx + cmLocalVisualStudio6Generator.cxx + cmGlobalBorlandMakefileGenerator.h + cmGlobalNMakeMakefileGenerator.h + cmGlobalVisualStudio6Generator.h + cmLocalVisualStudio6Generator.h + cmWin32ProcessExecution.cxx + cmWin32ProcessExecution.h + ) + IF(NOT MINGW) + SET(SRCS ${SRCS} + cmGlobalVisualStudio7Generator.h + cmLocalVisualStudio7Generator.h + cmGlobalVisualStudio71Generator.cxx + cmGlobalVisualStudio7Generator.cxx + cmLocalVisualStudio7Generator.cxx) + ENDIF(NOT MINGW) ENDIF(NOT UNIX) ENDIF (WIN32) @@ -95,10 +98,12 @@ LINK_DIRECTORIES(${CMake_BINARY_DIR}/Source) IF (WIN32) IF(NOT UNIX) IF( NOT BORLAND ) - LINK_LIBRARIES( rpcrt4.lib ) - ADD_EXECUTABLE(cmw9xcom cmw9xcom.cxx) - TARGET_LINK_LIBRARIES(cmw9xcom CMakeLib) - SUBDIRS(MFCDialog) + IF(NOT MINGW ) + LINK_LIBRARIES( rpcrt4.lib ) + ADD_EXECUTABLE(cmw9xcom cmw9xcom.cxx) + TARGET_LINK_LIBRARIES(cmw9xcom CMakeLib) + SUBDIRS(MFCDialog) + ENDIF(NOT MINGW ) ENDIF( NOT BORLAND ) ENDIF(NOT UNIX) ENDIF (WIN32) diff --git a/Source/CTest/Curl/telnet.c b/Source/CTest/Curl/telnet.c index c9db4ca..ef1b828 100644 --- a/Source/CTest/Curl/telnet.c +++ b/Source/CTest/Curl/telnet.c @@ -1105,7 +1105,7 @@ CURLcode Curl_telnet(struct connectdata *conn) ssize_t bytes_written; char *buffer = buf; - if(!ReadFile(stdin_handle, buf, 255, &(DWORD)nread, NULL)) { + if(!ReadFile(stdin_handle, buf, 255, ((DWORD*)&nread), NULL)) { keepon = FALSE; break; } diff --git a/Source/cmDynamicLoader.cxx b/Source/cmDynamicLoader.cxx index d9cd119..8a93610 100644 --- a/Source/cmDynamicLoader.cxx +++ b/Source/cmDynamicLoader.cxx @@ -266,7 +266,7 @@ cmDynamicLoader::GetSymbolAddress(cmLibHandle lib, const char* sym) delete [] wsym; void* result = ret; #else - void* result = GetProcAddress(lib, sym); + void* result = (void*)GetProcAddress(lib, sym); #endif // Hack to cast pointer-to-data to pointer-to-function. return *reinterpret_cast<cmDynamicLoaderFunction*>(&result); diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx index 5d9b6c3..cc384da 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.cxx +++ b/Source/cmGlobalBorlandMakefileGenerator.cxx @@ -21,6 +21,7 @@ cmGlobalBorlandMakefileGenerator::cmGlobalBorlandMakefileGenerator() { m_FindMakeProgramFile = "CMakeBorlandFindMake.cmake"; + m_ForceUnixPaths = false; } void cmGlobalBorlandMakefileGenerator::EnableLanguage(const char* l, diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index e5b83e8..85f197f 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -28,7 +28,8 @@ int cmGlobalGenerator::s_TryCompileTimeout = 0; cmGlobalGenerator::cmGlobalGenerator() { -// do nothing duh + // by default use the native paths + m_ForceUnixPaths = false; } cmGlobalGenerator::~cmGlobalGenerator() diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 20dcc08..3f4b1e3 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -104,7 +104,9 @@ public: void GetLocalGenerators(std::vector<cmLocalGenerator *>&g) { g = m_LocalGenerators;} static int s_TryCompileTimeout; + bool GetForceUnixPaths() {return m_ForceUnixPaths;} protected: + bool m_ForceUnixPaths; cmStdString m_FindMakeProgramFile; cmStdString m_ConfiguredFilesPath; cmake *m_CMakeInstance; diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx index 08b48c8..8615dd5 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.cxx +++ b/Source/cmGlobalNMakeMakefileGenerator.cxx @@ -22,6 +22,7 @@ cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator() { m_FindMakeProgramFile = "CMakeNMakeFindMake.cmake"; + m_ForceUnixPaths = false; } void cmGlobalNMakeMakefileGenerator::EnableLanguage(const char* l, diff --git a/Source/cmGlobalUnixMakefileGenerator.cxx b/Source/cmGlobalUnixMakefileGenerator.cxx index 79bbc38..8719fbd 100644 --- a/Source/cmGlobalUnixMakefileGenerator.cxx +++ b/Source/cmGlobalUnixMakefileGenerator.cxx @@ -22,6 +22,8 @@ cmGlobalUnixMakefileGenerator::cmGlobalUnixMakefileGenerator() { + // This type of makefile always requires unix style paths + m_ForceUnixPaths = true; m_FindMakeProgramFile = "CMakeUnixFindMake.cmake"; } diff --git a/Source/cmLocalUnixMakefileGenerator.cxx b/Source/cmLocalUnixMakefileGenerator.cxx index f77e7e3..01a535e 100644 --- a/Source/cmLocalUnixMakefileGenerator.cxx +++ b/Source/cmLocalUnixMakefileGenerator.cxx @@ -2117,7 +2117,7 @@ cmLocalUnixMakefileGenerator::ConvertToOutputForExisting(const char* p) { if(!cmSystemTools::GetShortPath(ret.c_str(), ret)) { - ret = p; + ret = cmSystemTools::ConvertToOutputPath(p); } } } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 69ce0af..9574624 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -48,6 +48,7 @@ bool cmSystemTools::s_DisableRunCommandOutput = false; bool cmSystemTools::s_ErrorOccured = false; bool cmSystemTools::s_FatalErrorOccured = false; bool cmSystemTools::s_DisableMessages = false; +bool cmSystemTools::s_ForceUnixPaths = false; std::string cmSystemTools::s_Windows9xComspecSubstitute = "command.com"; void cmSystemTools::SetWindows9xComspecSubstitute(const char* str) @@ -1032,3 +1033,17 @@ bool cmSystemTools::Split(const char* s, std::vector<cmStdString>& l) } return true; } + +std::string cmSystemTools::ConvertToOutputPath(const char* path) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + if(s_ForceUnixPaths) + { + return cmSystemTools::ConvertToUnixOutputPath(path); + } + return cmSystemTools::ConvertToWindowsOutputPath(path); +#else + return cmSystemTools::ConvertToUnixOutputPath(path); +#endif +} + diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 2ecd504..724c5ec 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -235,8 +235,14 @@ public: /** Split a string on its newlines into multiple lines. Returns false only if the last line stored had no newline. */ static bool Split(const char* s, std::vector<cmStdString>& l); - + static void SetForceUnixPaths(bool v) + { + s_ForceUnixPaths = v; + } + static std::string ConvertToOutputPath(const char* path); + private: + static bool s_ForceUnixPaths; static bool s_RunCommandHideConsole; static bool s_ErrorOccured; static bool s_FatalErrorOccured; diff --git a/Source/cmWin32ProcessExecution.cxx b/Source/cmWin32ProcessExecution.cxx index f718e23..b7eaea7 100644 --- a/Source/cmWin32ProcessExecution.cxx +++ b/Source/cmWin32ProcessExecution.cxx @@ -291,16 +291,17 @@ static BOOL RealPopenCreateProcess(const char *cmdstring, { PROCESS_INFORMATION piProcInfo; STARTUPINFO siStartInfo; - char *s1,*s2, *s3 = " /c "; + char *s1=0,*s2=0, *s3 = " /c "; int i; int x; if (i = GetEnvironmentVariable("COMSPEC",NULL,0)) { char *comshell; - s1 = (char *)_alloca(i); + s1 = (char *)malloc(i); if (!(x = GetEnvironmentVariable("COMSPEC", s1, i))) { + free(s1); return x; } @@ -317,7 +318,7 @@ static BOOL RealPopenCreateProcess(const char *cmdstring, { /* NT/2000 and not using command.com. */ x = i + (int)strlen(s3) + (int)strlen(cmdstring) + 1; - s2 = (char *)_alloca(x); + s2 = (char *)malloc(x); ZeroMemory(s2, x); //sprintf(s2, "%s%s%s", s1, s3, cmdstring); sprintf(s2, "%s", cmdstring); @@ -366,15 +367,20 @@ static BOOL RealPopenCreateProcess(const char *cmdstring, << "Can not locate '" << modulepath << "' which is needed " "for popen to work with your shell " - "or platform." << std::endl; + "or platform." << std::endl; + free(s1); + free(s2); return FALSE; } } x = i + (int)strlen(s3) + (int)strlen(cmdstring) + 1 + (int)strlen(modulepath) + (int)strlen(szConsoleSpawn) + 1; - - s2 = (char *)_alloca(x); + if(s2) + { + free(s2); + } + s2 = (char *)malloc(x); ZeroMemory(s2, x); sprintf( s2, @@ -396,7 +402,9 @@ static BOOL RealPopenCreateProcess(const char *cmdstring, else { std::cout << "Cannot locate a COMSPEC environment variable to " - << "use as the shell" << std::endl; + << "use as the shell" << std::endl; + free(s2); + free(s1); return FALSE; } @@ -429,11 +437,15 @@ static BOOL RealPopenCreateProcess(const char *cmdstring, /* Return process handle */ *hProcess = piProcInfo.hProcess; //std::cout << "Process created..." << std::endl; + free(s2); + free(s1); return TRUE; } output += "CreateProcessError "; output += s2; output += "\n"; + free(s2); + free(s1); return FALSE; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index e2dee84..c4c73dd 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -26,10 +26,13 @@ // include the generator #if defined(_WIN32) && !defined(__CYGWIN__) #include "cmGlobalVisualStudio6Generator.h" +#if !defined(__MINGW32__) #include "cmGlobalVisualStudio7Generator.h" #include "cmGlobalVisualStudio71Generator.h" +#endif #include "cmGlobalBorlandMakefileGenerator.h" #include "cmGlobalNMakeMakefileGenerator.h" +#include "cmGlobalUnixMakefileGenerator.h" #include "cmWin32ProcessExecution.h" #else #include "cmGlobalUnixMakefileGenerator.h" @@ -795,6 +798,10 @@ void cmake::SetGlobalGenerator(cmGlobalGenerator *gg) // set the new m_GlobalGenerator = gg; + // set the global flag for unix style paths on cmSystemTools as + // soon as the generator is set. This allows gmake to be used + // on windows. + cmSystemTools::SetForceUnixPaths(m_GlobalGenerator->GetForceUnixPaths()); // Save the environment variables CXX and CC m_CXXEnvironment = getenv("CXX"); m_CCEnvironment = getenv("CC"); @@ -877,6 +884,10 @@ int cmake::Configure() if(genName) { m_GlobalGenerator = this->CreateGlobalGenerator(genName); + // set the global flag for unix style paths on cmSystemTools as + // soon as the generator is set. This allows gmake to be used + // on windows. + cmSystemTools::SetForceUnixPaths(m_GlobalGenerator->GetForceUnixPaths()); } else { @@ -1065,6 +1076,10 @@ int cmake::LocalGenerate() if(genName) { m_GlobalGenerator = this->CreateGlobalGenerator(genName); + // set the global flag for unix style paths on cmSystemTools as + // soon as the generator is set. This allows gmake to be used + // on windows. + cmSystemTools::SetForceUnixPaths(m_GlobalGenerator->GetForceUnixPaths()); } else { @@ -1151,10 +1166,12 @@ void cmake::AddDefaultGenerators() #if defined(_WIN32) && !defined(__CYGWIN__) m_Generators[cmGlobalVisualStudio6Generator::GetActualName()] = &cmGlobalVisualStudio6Generator::New; +#if !defined(__MINGW32__) m_Generators[cmGlobalVisualStudio7Generator::GetActualName()] = &cmGlobalVisualStudio7Generator::New; m_Generators[cmGlobalVisualStudio71Generator::GetActualName()] = &cmGlobalVisualStudio71Generator::New; +#endif m_Generators[cmGlobalBorlandMakefileGenerator::GetActualName()] = &cmGlobalBorlandMakefileGenerator::New; m_Generators[cmGlobalNMakeMakefileGenerator::GetActualName()] = @@ -1164,9 +1181,9 @@ void cmake::AddDefaultGenerators() m_Generators[cmGlobalCodeWarriorGenerator::GetActualName()] = &cmGlobalCodeWarriorGenerator::New; # endif +#endif m_Generators[cmGlobalUnixMakefileGenerator::GetActualName()] = &cmGlobalUnixMakefileGenerator::New; -#endif } int cmake::LoadCache() diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 69523e1..576de34 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -38,7 +38,7 @@ #include <sys/wait.h> #endif -#if defined(_WIN32) && (defined(_MSC_VER) || defined(__BORLANDC__)) +#if defined(_WIN32) && (defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MINGW32__)) #include <string.h> #include <windows.h> #include <direct.h> |