summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2002-12-20 17:59:18 (GMT)
committerBrad King <brad.king@kitware.com>2002-12-20 17:59:18 (GMT)
commit4e6ad941e981e81b53876508d17d1c3ef06938f2 (patch)
tree01940cd7e170d0db1c808a9dc381c866d83a03fa
parent309748ff79d827e191e93f8c28f42768dd5d3966 (diff)
downloadCMake-4e6ad941e981e81b53876508d17d1c3ef06938f2.zip
CMake-4e6ad941e981e81b53876508d17d1c3ef06938f2.tar.gz
CMake-4e6ad941e981e81b53876508d17d1c3ef06938f2.tar.bz2
ENH: Visual Studio 6 and 7 generators now set CMAKE_CONFIGURATION_TYPES to be a semicolon-separated list of configurations that will be built.
-rw-r--r--Modules/Platform/Windows-cl.cmake4
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx31
-rw-r--r--Source/cmGlobalVisualStudio6Generator.h1
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx30
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h2
-rw-r--r--Templates/CMakeVisualStudio6Configurations.cmake3
6 files changed, 59 insertions, 12 deletions
diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake
index 92e4e41..5dffeb4 100644
--- a/Modules/Platform/Windows-cl.cmake
+++ b/Modules/Platform/Windows-cl.cmake
@@ -67,8 +67,8 @@ IF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
SET (CMAKE_NO_BUILD_TYPE 1)
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
IF(CMAKE_GENERATOR MATCHES "Visual Studio 7")
- SET (CMAKE_CONFIGURATION_TYPES "Debug Release MinSizeRel RelWithDebInfo" CACHE STRING
- "Space separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.")
+ 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.")
SET (CMAKE_CXX_WARNING_LEVEL "3" CACHE STRING
"Size of stack for programs.")
SET (CMAKE_CXX_STACK_SIZE "10000000" CACHE STRING
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index c19ba04..111a0a2 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -30,9 +30,40 @@ void cmGlobalVisualStudio6Generator::EnableLanguage(const char* lang,
mf->AddDefinition("CMAKE_CFG_INTDIR","$(IntDir)");
mf->AddDefinition("CMAKE_GENERATOR_CC", "cl");
mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl");
+ this->GenerateConfigurations(mf);
this->cmGlobalGenerator::EnableLanguage(lang, mf);
}
+void cmGlobalVisualStudio6Generator::GenerateConfigurations(cmMakefile* mf)
+{
+ std::string fname= mf->GetDefinition("CMAKE_ROOT");
+ const char* def= mf->GetDefinition( "MSPROJECT_TEMPLATE_DIRECTORY");
+ if(def)
+ {
+ fname = def;
+ }
+ else
+ {
+ fname += "/Templates";
+ }
+ fname += "/CMakeVisualStudio6Configurations.cmake";
+ if(!mf->ReadListFile(mf->GetCurrentListFile(), fname.c_str()))
+ {
+ cmSystemTools::Error("Cannot open ", fname.c_str(),
+ ". Please copy this file from the main "
+ "CMake/Templates directory and edit it for "
+ "your build configurations.");
+ }
+ else if(!mf->GetDefinition("CMAKE_CONFIGURATION_TYPES"))
+ {
+ cmSystemTools::Error("CMAKE_CONFIGURATION_TYPES not set by ",
+ fname.c_str(),
+ ". Please copy this file from the main "
+ "CMake/Templates directory and edit it for "
+ "your build configurations.");
+ }
+}
+
int cmGlobalVisualStudio6Generator::TryCompile(const char *,
const char *bindir,
const char *projectName,
diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h
index 9e72b85..be2dfd9 100644
--- a/Source/cmGlobalVisualStudio6Generator.h
+++ b/Source/cmGlobalVisualStudio6Generator.h
@@ -66,6 +66,7 @@ public:
virtual void OutputDSWFile();
private:
+ void GenerateConfigurations(cmMakefile* mf);
void SetupTests();
void WriteDSWFile(std::ostream& fout);
void WriteDSWHeader(std::ostream& fout);
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 7e62e21..f7a0a45 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -33,11 +33,12 @@ void cmGlobalVisualStudio7Generator::EnableLanguage(const char* lang,
mf->AddDefinition("CMAKE_CFG_INTDIR","$(IntDir)");
mf->AddDefinition("CMAKE_GENERATOR_CC", "cl");
mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl");
+
+ // Create list of configurations requested by user's cache, if any.
+ this->GenerateConfigurations(mf);
this->cmGlobalGenerator::EnableLanguage(lang, mf);
}
-
-
int cmGlobalVisualStudio7Generator::TryCompile(const char *,
const char *bindir,
const char *projectName,
@@ -150,7 +151,7 @@ void cmGlobalVisualStudio7Generator::SetupTests()
}
}
-void cmGlobalVisualStudio7Generator::GenerateConfigurations()
+void cmGlobalVisualStudio7Generator::GenerateConfigurations(cmMakefile* mf)
{
// process the configurations
const char* ct
@@ -163,7 +164,7 @@ void cmGlobalVisualStudio7Generator::GenerateConfigurations()
std::string::size_type endpos = 0;
while(endpos != std::string::npos)
{
- endpos = configTypes.find(' ', start);
+ endpos = configTypes.find_first_of(" ;", start);
std::string config;
std::string::size_type len;
if(endpos != std::string::npos)
@@ -200,13 +201,26 @@ void cmGlobalVisualStudio7Generator::GenerateConfigurations()
m_Configurations.push_back("Debug");
m_Configurations.push_back("Release");
}
+
+ // Reset the entry to have a semi-colon separated list.
+ std::string configs = m_Configurations[0];
+ for(unsigned int i=1; i < m_Configurations.size(); ++i)
+ {
+ configs += ";";
+ configs += m_Configurations[i];
+ }
+
+ mf->AddCacheDefinition(
+ "CMAKE_CONFIGURATION_TYPES",
+ configs.c_str(),
+ "Semicolon separated list of supported configuration types, "
+ "only supports Debug, Release, MinSizeRel, and RelWithDebInfo, "
+ "anything else will be ignored.",
+ cmCacheManager::STRING);
}
void cmGlobalVisualStudio7Generator::Generate()
{
- // Generate the possible configuraitons
- this->GenerateConfigurations();
-
// add a special target that depends on ALL projects for easy build
// of Debug only
m_LocalGenerators[0]->GetMakefile()->
@@ -580,8 +594,6 @@ std::string cmGlobalVisualStudio7Generator::CreateGUID(const char* name)
void cmGlobalVisualStudio7Generator::LocalGenerate()
{
- // load the possible configuraitons
- this->GenerateConfigurations();
this->cmGlobalGenerator::LocalGenerate();
}
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index ce87c6b..2fa8ca6 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -78,7 +78,7 @@ public:
private:
void SetupTests();
- void GenerateConfigurations();
+ void GenerateConfigurations(cmMakefile* mf);
void WriteSLNFile(std::ostream& fout);
void WriteSLNHeader(std::ostream& fout);
void WriteProject(std::ostream& fout,
diff --git a/Templates/CMakeVisualStudio6Configurations.cmake b/Templates/CMakeVisualStudio6Configurations.cmake
new file mode 100644
index 0000000..a9db2ee
--- /dev/null
+++ b/Templates/CMakeVisualStudio6Configurations.cmake
@@ -0,0 +1,3 @@
+# When the dll templates are changed, this list should be
+# updated with the list of possible configurations.
+SET(CMAKE_CONFIGURATION_TYPES Debug Release MinSizeRel RelWithDebInfo)