ENH: add support for VCExpress 2005

This commit is contained in:
Bill Hoffman 2004-07-05 12:16:33 -04:00
parent bbc9e4a9dc
commit 86195caf6a
10 changed files with 207 additions and 34 deletions

View File

@ -0,0 +1,10 @@
FIND_PROGRAM(CMAKE_MAKE_PROGRAM
NAMES VCExpress
PATHS
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VS;EnvironmentDirectory]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup;Dbghelp_path]
"c:/Program Files/Microsoft Visual Studio 8/Common7/IDE"
"c:/Program Files/Microsoft Visual Studio8/Common7/IDE"
"/Program Files/Microsoft Visual Studio 8/Common7/IDE/"
)
MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM)

View File

@ -40,28 +40,10 @@ SET(CMAKE_CXX_LINK_EXECUTABLE
SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows) SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows)
SET(CMAKE_CREATE_CONSOLE_EXE /subsystem:console) SET(CMAKE_CREATE_CONSOLE_EXE /subsystem:console)
# default to Debug builds
SET(CMAKE_BUILD_TYPE_INIT Debug)
SET (CMAKE_CXX_FLAGS_INIT "/W3 /Zm1000 /GX /GR")
SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/MDd /Zi /Od /GZ")
SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /D NDEBUG")
SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /D NDEBUG")
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /D NDEBUG")
SET (CMAKE_C_FLAGS_INIT "/W3 /Zm1000")
SET (CMAKE_C_FLAGS_DEBUG_INIT "/MDd /Zi /Od /GZ")
SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /D NDEBUG")
SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /D NDEBUG")
SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /D NDEBUG")
SET (CMAKE_STANDARD_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.")
MARK_AS_ADVANCED(CMAKE_STANDARD_LIBRARIES)
IF(CMAKE_GENERATOR MATCHES "Visual Studio 6") IF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
SET (CMAKE_NO_BUILD_TYPE 1) SET (CMAKE_NO_BUILD_TYPE 1)
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6") ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
IF(CMAKE_GENERATOR MATCHES "Visual Studio 7") IF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visual Studio 8")
SET (CMAKE_NO_BUILD_TYPE 1) SET (CMAKE_NO_BUILD_TYPE 1)
SET (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING SET (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING
"Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.") "Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.")
@ -70,10 +52,13 @@ IF(CMAKE_GENERATOR MATCHES "Visual Studio 7")
SET (CMAKE_CXX_STACK_SIZE "10000000" CACHE STRING SET (CMAKE_CXX_STACK_SIZE "10000000" CACHE STRING
"Size of stack for programs.") "Size of stack for programs.")
MARK_AS_ADVANCED(CMAKE_CONFIGURATION_TYPES CMAKE_CXX_STACK_SIZE CMAKE_CXX_WARNING_LEVEL) MARK_AS_ADVANCED(CMAKE_CONFIGURATION_TYPES CMAKE_CXX_STACK_SIZE CMAKE_CXX_WARNING_LEVEL)
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7") ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visual Studio 8")
# does the compiler support pdbtype and is it the newer compiler
# does the compiler support pdbtype
SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1) SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1)
SET(CMAKE_COMPILER_2005 0)
IF(CMAKE_GENERATOR MATCHES "Visual Studio 8")
SET(CMAKE_COMPILER_2005 1)
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8")
IF(CMAKE_GENERATOR MATCHES "NMake Makefiles") IF(CMAKE_GENERATOR MATCHES "NMake Makefiles")
EXEC_PROGRAM(${CMAKE_C_COMPILER} EXEC_PROGRAM(${CMAKE_C_COMPILER}
ARGS /nologo -EP \"${CMAKE_ROOT}/Modules/CMakeTestNMakeCLVersion.c\" ARGS /nologo -EP \"${CMAKE_ROOT}/Modules/CMakeTestNMakeCLVersion.c\"
@ -84,10 +69,49 @@ IF(CMAKE_GENERATOR MATCHES "NMake Makefiles")
IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*VERSION=1[3-9][0-9][0-9].*" ) IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*VERSION=1[3-9][0-9][0-9].*" )
SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0)
ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*VERSION=1[3-9][0-9][0-9].*" ) ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*VERSION=1[3-9][0-9][0-9].*" )
IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*VERSION=1[4-9][0-9][0-9].*" )
SET(CMAKE_COMPILER_2005 1)
ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*VERSION=1[4-9][0-9][0-9].*" )
ENDIF(NOT CMAKE_COMPILER_RETURN) ENDIF(NOT CMAKE_COMPILER_RETURN)
ENDIF(CMAKE_GENERATOR MATCHES "NMake Makefiles") ENDIF(CMAKE_GENERATOR MATCHES "NMake Makefiles")
# default to Debug builds
IF(CMAKE_COMPILER_2005)
SET(CMAKE_BUILD_TYPE_INIT Debug)
SET (CMAKE_CXX_FLAGS_INIT "/W3 /Zm1000 /EHsc /GR")
SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/MDd /Zi /Od /RTC1")
SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /D NDEBUG")
SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /D NDEBUG")
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /D NDEBUG")
SET (CMAKE_C_FLAGS_INIT "/W3 /Zm1000")
SET (CMAKE_C_FLAGS_DEBUG_INIT "/MDd /Zi /Od /GZ")
SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /D NDEBUG")
SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /D NDEBUG")
SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /D NDEBUG")
SET (CMAKE_STANDARD_LIBRARIES "kernel32.lib" CACHE STRING
"Libraries linked by defalut with all applications.")
ELSE(CMAKE_COMPILER_2005)
SET(CMAKE_BUILD_TYPE_INIT Debug)
SET (CMAKE_CXX_FLAGS_INIT "/W3 /Zm1000 /GX /GR")
SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/MDd /Zi /Od /GZ")
SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /D NDEBUG")
SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /D NDEBUG")
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /D NDEBUG")
SET (CMAKE_C_FLAGS_INIT "/W3 /Zm1000")
SET (CMAKE_C_FLAGS_DEBUG_INIT "/MDd /Zi /Od /GZ")
SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /D NDEBUG")
SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /D NDEBUG")
SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /D NDEBUG")
SET (CMAKE_STANDARD_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.")
ENDIF(CMAKE_COMPILER_2005)
MARK_AS_ADVANCED(CMAKE_STANDARD_LIBRARIES)
# executable linker flags # executable linker flags
SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:")
SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /machine:I386 /INCREMENTAL:YES") SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /machine:I386 /INCREMENTAL:YES")

View File

@ -79,8 +79,11 @@ IF (WIN32)
) )
IF(NOT MINGW) IF(NOT MINGW)
SET(SRCS ${SRCS} SET(SRCS ${SRCS}
cmGlobalVisualStudio71Generator.h
cmGlobalVisualStudio8Generator.h
cmGlobalVisualStudio7Generator.h cmGlobalVisualStudio7Generator.h
cmLocalVisualStudio7Generator.h cmLocalVisualStudio7Generator.h
cmGlobalVisualStudio8Generator.cxx
cmGlobalVisualStudio71Generator.cxx cmGlobalVisualStudio71Generator.cxx
cmGlobalVisualStudio7Generator.cxx cmGlobalVisualStudio7Generator.cxx
cmLocalVisualStudio7Generator.cxx) cmLocalVisualStudio7Generator.cxx)

View File

@ -322,26 +322,36 @@ BOOL CMakeSetupDialog::OnInitDialog()
{ {
// check for vs7 in registry then decide what default to use // check for vs7 in registry then decide what default to use
std::string mp; std::string mp;
mp = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1;InstallDir]"; mp = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup;Dbghelp_path";
cmSystemTools::ExpandRegistryValues(mp); cmSystemTools::ExpandRegistryValues(mp);
if (mp != "/registry") if(mp != "/registry")
{ {
m_GeneratorChoiceString = "Visual Studio 7 .NET 2003"; m_GeneratorChoiceString = "Visual Studio 8 2005";
} }
else else
{ {
mp = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.0;InstallDir]"; mp = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1;InstallDir]";
cmSystemTools::ExpandRegistryValues(mp); cmSystemTools::ExpandRegistryValues(mp);
if (mp != "/registry") if (mp != "/registry")
{ {
m_GeneratorChoiceString = "Visual Studio 7"; m_GeneratorChoiceString = "Visual Studio 7 .NET 2003";
} }
else else
{ {
m_GeneratorChoiceString = "Visual Studio 6"; mp = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.0;InstallDir]";
cmSystemTools::ExpandRegistryValues(mp);
if (mp != "/registry")
{
m_GeneratorChoiceString = "Visual Studio 7";
}
else
{
m_GeneratorChoiceString = "Visual Studio 6";
}
} }
} }
} }
// try to load the cmake cache from disk // try to load the cmake cache from disk
this->LoadCacheFromDiskToGUI(); this->LoadCacheFromDiskToGUI();

View File

@ -74,9 +74,22 @@ void cmGlobalGenerator::EnableLanguage(const char* lang,
return; return;
} }
std::string makeProgram = mf->GetDefinition("CMAKE_MAKE_PROGRAM"); std::string makeProgram = mf->GetDefinition("CMAKE_MAKE_PROGRAM");
// if there are spaces in the make program use short path
// but do not short path the actual program name, as
// this can cause trouble with VSExpress
if(makeProgram.find(' ') != makeProgram.npos) if(makeProgram.find(' ') != makeProgram.npos)
{ {
std::string dir;
std::string file;
cmSystemTools::SplitProgramPath(makeProgram.c_str(),
dir, file);
std::string saveFile = file;
cmSystemTools::GetShortPath(makeProgram.c_str(), makeProgram); cmSystemTools::GetShortPath(makeProgram.c_str(), makeProgram);
cmSystemTools::SplitProgramPath(makeProgram.c_str(),
dir, file);
makeProgram = dir;
makeProgram += "/";
makeProgram += saveFile;
this->GetCMakeInstance()->AddCacheEntry("CMAKE_MAKE_PROGRAM", makeProgram.c_str(), this->GetCMakeInstance()->AddCacheEntry("CMAKE_MAKE_PROGRAM", makeProgram.c_str(),
"make program", "make program",
cmCacheManager::FILEPATH); cmCacheManager::FILEPATH);

View File

@ -0,0 +1,54 @@
/*=========================================================================
Program: CMake - Cross-Platform Makefile Generator
Module: $RCSfile$
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "windows.h" // this must be first to define GetCurrentDirectory
#include "cmGlobalVisualStudio8Generator.h"
#include "cmLocalVisualStudio7Generator.h"
#include "cmMakefile.h"
#include "cmake.h"
cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator()
{
m_FindMakeProgramFile = "CMakeVS8FindMake.cmake";
}
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalVisualStudio8Generator::CreateLocalGenerator()
{
cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator;
lg->SetVersion8();
lg->SetGlobalGenerator(this);
return lg;
}
// ouput standard header for dsw file
void cmGlobalVisualStudio8Generator::WriteSLNHeader(std::ostream& fout)
{
fout << "Microsoft Visual Studio Solution File, Format Version 9.00\n";
}
//----------------------------------------------------------------------------
void cmGlobalVisualStudio8Generator::GetDocumentation(cmDocumentationEntry& entry) const
{
entry.name = this->GetName();
entry.brief = "Generates Visual Studio .NET 2005 project files.";
entry.full = "";
}

View File

@ -0,0 +1,48 @@
/*=========================================================================
Program: CMake - Cross-Platform Makefile Generator
Module: $RCSfile$
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef cmGlobalVisualStudio8Generator_h
#define cmGlobalVisualStudio8Generator_h
#include "cmGlobalVisualStudio71Generator.h"
/** \class cmGlobalVisualStudio8Generator
* \brief Write a Unix makefiles.
*
* cmGlobalVisualStudio8Generator manages UNIX build process for a tree
*/
class cmGlobalVisualStudio8Generator : public cmGlobalVisualStudio71Generator
{
public:
cmGlobalVisualStudio8Generator();
static cmGlobalGenerator* New() { return new cmGlobalVisualStudio8Generator; }
///! Get the name for the generator.
virtual const char* GetName() const {
return cmGlobalVisualStudio8Generator::GetActualName();}
static const char* GetActualName() {return "Visual Studio 8 2005";}
/** Get the documentation entry for this generator. */
virtual void GetDocumentation(cmDocumentationEntry& entry) const;
///! Create a local generator appropriate to this Global Generator
virtual cmLocalGenerator *CreateLocalGenerator();
protected:
virtual void WriteSLNHeader(std::ostream& fout);
};
#endif

View File

@ -24,7 +24,7 @@
cmLocalVisualStudio7Generator::cmLocalVisualStudio7Generator() cmLocalVisualStudio7Generator::cmLocalVisualStudio7Generator()
{ {
m_Version71 = false; m_Version = 7;
} }
cmLocalVisualStudio7Generator::~cmLocalVisualStudio7Generator() cmLocalVisualStudio7Generator::~cmLocalVisualStudio7Generator()
@ -1172,13 +1172,20 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout,
fout << "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\n" fout << "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\n"
<< "<VisualStudioProject\n" << "<VisualStudioProject\n"
<< "\tProjectType=\"Visual C++\"\n"; << "\tProjectType=\"Visual C++\"\n";
if(m_Version71) if(m_Version == 71)
{ {
fout << "\tVersion=\"7.10\"\n"; fout << "\tVersion=\"7.10\"\n";
} }
else else
{ {
fout << "\tVersion=\"7.00\"\n"; if (m_Version == 8)
{
fout << "\tVersion=\"8.0\"\n";
}
else
{
fout << "\tVersion=\"7.00\"\n";
}
} }
fout << "\tName=\"" << libName << "\"\n" fout << "\tName=\"" << libName << "\"\n"

View File

@ -63,7 +63,8 @@ public:
{ {
return m_CreatedProjectNames; return m_CreatedProjectNames;
} }
void SetVersion71() {m_Version71 = true;} void SetVersion71() {m_Version = 71;}
void SetVersion8() {m_Version = 8;}
virtual void ConfigureFinalPass(); virtual void ConfigureFinalPass();
private: private:
void OutputVCProjFile(); void OutputVCProjFile();
@ -118,7 +119,7 @@ private:
std::string m_LibraryOutputPath; std::string m_LibraryOutputPath;
std::string m_ExecutableOutputPath; std::string m_ExecutableOutputPath;
std::string m_ModuleDefinitionFile; std::string m_ModuleDefinitionFile;
bool m_Version71; int m_Version;
}; };
#endif #endif

View File

@ -29,6 +29,7 @@
#if !defined(__MINGW32__) #if !defined(__MINGW32__)
#include "cmGlobalVisualStudio7Generator.h" #include "cmGlobalVisualStudio7Generator.h"
#include "cmGlobalVisualStudio71Generator.h" #include "cmGlobalVisualStudio71Generator.h"
#include "cmGlobalVisualStudio8Generator.h"
#endif #endif
#include "cmGlobalBorlandMakefileGenerator.h" #include "cmGlobalBorlandMakefileGenerator.h"
#include "cmGlobalNMakeMakefileGenerator.h" #include "cmGlobalNMakeMakefileGenerator.h"
@ -1348,6 +1349,8 @@ void cmake::AddDefaultGenerators()
&cmGlobalVisualStudio7Generator::New; &cmGlobalVisualStudio7Generator::New;
m_Generators[cmGlobalVisualStudio71Generator::GetActualName()] = m_Generators[cmGlobalVisualStudio71Generator::GetActualName()] =
&cmGlobalVisualStudio71Generator::New; &cmGlobalVisualStudio71Generator::New;
m_Generators[cmGlobalVisualStudio8Generator::GetActualName()] =
&cmGlobalVisualStudio8Generator::New;
#endif #endif
m_Generators[cmGlobalBorlandMakefileGenerator::GetActualName()] = m_Generators[cmGlobalBorlandMakefileGenerator::GetActualName()] =
&cmGlobalBorlandMakefileGenerator::New; &cmGlobalBorlandMakefileGenerator::New;