summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2002-02-27 23:11:12 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2002-02-27 23:11:12 (GMT)
commit6c1e38abb4d36cebaff76807bd0e5979b520b6f9 (patch)
tree2523cbbb76e80188daedb819edb2530f889941e4
parent0b6f8be725a48e929bcf7c2e8003ef2f03494b06 (diff)
downloadCMake-6c1e38abb4d36cebaff76807bd0e5979b520b6f9.zip
CMake-6c1e38abb4d36cebaff76807bd0e5979b520b6f9.tar.gz
CMake-6c1e38abb4d36cebaff76807bd0e5979b520b6f9.tar.bz2
clean up in dot net
-rw-r--r--Source/cmMSDotNETGenerator.cxx118
-rw-r--r--Source/cmSystemTools.cxx6
-rw-r--r--Templates/CMakeDotNetSystemConfig.cmake20
3 files changed, 98 insertions, 46 deletions
diff --git a/Source/cmMSDotNETGenerator.cxx b/Source/cmMSDotNETGenerator.cxx
index 610c40e..521f27d 100644
--- a/Source/cmMSDotNETGenerator.cxx
+++ b/Source/cmMSDotNETGenerator.cxx
@@ -24,18 +24,43 @@
#include "cmSourceGroup.h"
+
cmMSDotNETGenerator::cmMSDotNETGenerator()
{
- m_Configurations.push_back("Debug");
- m_Configurations.push_back("Release");
-// m_Configurations.push_back("MinSizeRel");
-// m_Configurations.push_back("RelWithDebInfo");
// default to building a sln project file
BuildProjOn();
}
void cmMSDotNETGenerator::GenerateMakefile()
{
+ std::string configTypes = m_Makefile->GetDefinition("CMAKE_CONFIGURATION_TYPES");
+ std::string::size_type start = 0;
+ std::string::size_type endpos = 0;
+ while(endpos != std::string::npos)
+ {
+ endpos = configTypes.find(' ', start);
+ if(endpos != std::string::npos)
+ {
+ std::string config = configTypes.substr(start, endpos - start);
+ if(config == "Debug" || config == "Release" ||
+ config == "MinSizeRel" || config == "RelWithDebInfo")
+ {
+ m_Configurations.push_back(config);
+ }
+ else
+ {
+ cmSystemTools::Error("Invalid configuration type in CMAKE_CONFIGURATION_TYPES: ",
+ config.c_str(),
+ " (Valid types are Debug,Release,MinSizeRel,RelWithDebInfo)");
+ }
+ }
+ start = endpos+1;
+ }
+ if(m_Configurations.size() == 0)
+ {
+ m_Configurations.push_back("Debug");
+ m_Configurations.push_back("Release");
+ }
if(m_BuildSLN)
{
this->OutputSLNFile();
@@ -675,7 +700,7 @@ void cmMSDotNETGenerator::WriteConfiguration(std::ostream& fout,
}
fout << "\t\t<Configuration\n"
<< "\t\t\tName=\"" << configName << "|Win32\"\n"
- << "\t\t\tOutputDirectory=\"";
+ << "\t\t\tOutputDirectory=\"" << configName << "\"\n";
// This is an internal type to Visual Studio, it seems that:
// 4 == static library
// 2 == dll
@@ -686,22 +711,18 @@ void cmMSDotNETGenerator::WriteConfiguration(std::ostream& fout,
{
case cmTarget::STATIC_LIBRARY:
configType = "4";
- fout << m_LibraryOutputPath << configName << "\"\n";
break;
case cmTarget::SHARED_LIBRARY:
case cmTarget::MODULE_LIBRARY:
- fout << m_LibraryOutputPath << configName << "\"\n";
configType = "2";
break;
case cmTarget::EXECUTABLE:
case cmTarget::WIN32_EXECUTABLE:
- fout << m_ExecutableOutputPath << configName << "\"\n";
configType = "1";
break;
case cmTarget::UTILITY:
configType = "10";
default:
- fout << configName << "\"\n";
break;
}
@@ -720,47 +741,66 @@ void cmMSDotNETGenerator::WriteConfiguration(std::ostream& fout,
std::vector<std::string>::iterator i = includes.begin();
if(i != includes.end())
{
- fout << "&quot;" << *i << "&quot;";
+ fout << "&quot;" << cmSystemTools::ConvertToOutputPath(i->c_str()) << "&quot;";
}
for(;i != includes.end(); ++i)
{
- fout << ";&quot;" << *i << "&quot;";
+ fout << ";&quot;" << cmSystemTools::ConvertToOutputPath(i->c_str()) << "&quot;";
}
fout << "\"\n";
+// Optimization = 0 None Debug /O0
+// Optimization = 1 MinSize /O1
+// Optimization = 2 MaxSpeed /O2
+// Optimization = 3 Max Optimization /O3
+// RuntimeLibrary = 0 /MT multithread
+// RuntimeLibrary = 1 /MTd multithread debug
+// RuntimeLibrary = 2 /MD multithread dll
+// RuntimeLibrary = 3 /MDd multithread dll debug
+// RuntimeLibrary = 4 /ML single thread
+// RuntimeLibrary = 5 /MLd single thread debug
+// InlineFunctionExpansion = 0 none
+// InlineFunctionExpansion = 1 when inline keyword
+// InlineFunctionExpansion = 2 any time you can
+
+
if(strcmp(configName, "Debug") == 0)
{
fout << "\t\t\t\tOptimization=\"0\"\n"
<< "\t\t\t\tRuntimeLibrary=\"3\"\n"
+ << "\t\t\t\tInlineFunctionExpansion=\"0\"\n"
<< "\t\t\t\tPreprocessorDefinitions=\"WIN32,_DEBUG,_WINDOWS";
}
else if(strcmp(configName, "Release") == 0)
{
fout << "\t\t\t\tOptimization=\"2\"\n"
- << "\t\t\t\tRuntimeLibrary=\"0\"\n"
+ << "\t\t\t\tRuntimeLibrary=\"2\"\n"
<< "\t\t\t\tInlineFunctionExpansion=\"1\"\n"
<< "\t\t\t\tPreprocessorDefinitions=\"WIN32,NDEBUG,_WINDOWS";
}
else if(strcmp(configName, "MinSizeRel") == 0)
{
fout << "\t\t\t\tOptimization=\"1\"\n"
- << "\t\t\t\tRuntimeLibrary=\"0\"\n"
+ << "\t\t\t\tRuntimeLibrary=\"2\"\n"
<< "\t\t\t\tInlineFunctionExpansion=\"1\"\n"
<< "\t\t\t\tPreprocessorDefinitions=\"WIN32,NDEBUG,_WINDOWS";
}
else if(strcmp(configName, "RelWithDebInfo") == 0)
{
fout << "\t\t\t\tOptimization=\"2\"\n"
+ << "\t\t\t\tRuntimeLibrary=\"2\"\n"
<< "\t\t\t\tInlineFunctionExpansion=\"1\"\n"
<< "\t\t\t\tPreprocessorDefinitions=\"WIN32,NDEBUG,_WINDOWS";
}
this->OutputDefineFlags(fout);
fout << "\"\n";
- fout << "\t\t\t\tRuntimeTypeInfo=\"TRUE\"\n";
+ if(m_Makefile->IsOn("CMAKE_CXX_USE_RTTI"))
+ {
+ fout << "\t\t\t\tRuntimeTypeInfo=\"TRUE\"\n";
+ }
fout << "\t\t\t\tAssemblerListingLocation=\"" << configName << "\"\n";
fout << "\t\t\t\tObjectFile=\"" << configName << "\\\"\n";
- fout << "\t\t\t\tProgramDataBaseFileName=\"" << configName << "\"\n";
- fout << "\t\t\t\tWarningLevel=\"3\"\n";
+ fout << "\t\t\t\tWarningLevel=\"" << m_Makefile->GetDefinition("CMAKE_CXX_WARNING_LEVEL") << "\"\n";
fout << "\t\t\t\tDetect64BitPortabilityProblems=\"TRUE\"\n"
<< "\t\t\t\tDebugInformationFormat=\"3\"";
fout << "/>\n"; // end of <Tool Name=VCCLCompilerTool
@@ -785,48 +825,48 @@ void cmMSDotNETGenerator::OutputBuildTool(std::ostream& fout,
case cmTarget::STATIC_LIBRARY:
fout << "\t\t\t<Tool\n"
<< "\t\t\t\tName=\"VCLibrarianTool\"\n"
- << "\t\t\t\t\tOutputFile=\"" << m_LibraryOutputPath << configName
+ << "\t\t\t\t\tOutputFile=\"" << m_LibraryOutputPath << "$(OutDir)"
<< "/" << libName << ".lib\"/>\n";
break;
case cmTarget::SHARED_LIBRARY:
case cmTarget::MODULE_LIBRARY:
break;
case cmTarget::EXECUTABLE:
- fout << "\t\t\t<Tool\n"
- << "\t\t\t\tName=\"VCLinkerTool\"\n"
- << "\t\t\t\tAdditionalOptions=\"/MACHINE:I386\"\n"
- << "\t\t\t\tAdditionalDependencies=\" odbc32.lib odbccp32.lib ";
- this->OutputLibraries(fout, configName, libName, target);
- fout << "\"\n";
- fout << "\t\t\t\tOutputFile=\"" << m_ExecutableOutputPath <<
- configName << "/" << libName << ".exe\"\n";
- fout << "\t\t\t\tLinkIncremental=\"1\"\n";
- fout << "\t\t\t\tSuppressStartupBanner=\"TRUE\"\n";
- fout << "\t\t\t\tAdditionalLibraryDirectories=\"";
- this->OutputLibraryDirectories(fout, configName, libName, target);
- fout << "\"\n";
- fout << "\t\t\t\tProgramDatabaseFile=\"" << m_LibraryOutputPath << libName << ".pdb\"\n";
- fout << "\t\t\t\tSubSystem=\"1\"\n";
- fout << "\t\t\t\tStackReserveSize=\"10000000\"/>\n";
- break;
case cmTarget::WIN32_EXECUTABLE:
+
fout << "\t\t\t<Tool\n"
<< "\t\t\t\tName=\"VCLinkerTool\"\n"
<< "\t\t\t\tAdditionalOptions=\"/MACHINE:I386\"\n"
<< "\t\t\t\tAdditionalDependencies=\" odbc32.lib odbccp32.lib ";
this->OutputLibraries(fout, configName, libName, target);
fout << "\"\n";
- fout << "\t\t\t\tOutputFile=\"" << m_ExecutableOutputPath <<
- configName << "/" << libName << ".exe\"\n";
+ fout << "\t\t\t\tOutputFile=\""
+ << m_ExecutableOutputPath << configName << "/" << libName << ".exe\"\n";
fout << "\t\t\t\tLinkIncremental=\"1\"\n";
fout << "\t\t\t\tSuppressStartupBanner=\"TRUE\"\n";
fout << "\t\t\t\tAdditionalLibraryDirectories=\"";
this->OutputLibraryDirectories(fout, configName, libName, target);
fout << "\"\n";
- fout << "\t\t\t\tProgramDatabaseFile=\"" << m_LibraryOutputPath << libName << ".pdb\"\n";
- fout << "\t\t\t\tSubSystem=\"2\"\n";
- fout << "\t\t\t\tStackReserveSize=\"10000000\"/>\n";
+ fout << "\t\t\t\tProgramDatabaseFile=\"" << m_LibraryOutputPath
+ << "$(OutDir)\\" << libName << ".pdb\"\n";
+ if(strcmp(configName, "Debug") == 0)
+ {
+ fout << "\t\t\t\tGenerateDebugInformation=\"TRUE\"\n";
+ }
+ if( target.GetType() == cmTarget::EXECUTABLE)
+ {
+ fout << "\t\t\t\tSubSystem=\"1\"\n";
+ }
+ else
+ {
+ fout << "\t\t\t\tSubSystem=\"2\"\n";
+ }
+ fout << "\t\t\t\tStackReserveSize=\""
+ << m_Makefile->GetDefinition("CMAKE_CXX_STACK_SIZE") << "\"/>\n";
break;
+
+ fout << "\t\t\t\tSubSystem=\"2\"\n";
+
case cmTarget::UTILITY:
break;
}
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 13d178b..ebbcaa6 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -636,7 +636,7 @@ void cmSystemTools::GetArguments(std::string& line,
while(!done)
{
std::string arg;
- long endpos;
+ unsigned int endpos;
bool foundQuoted = quotedArgument.find(line.c_str());
bool foundNormal = normalArgument.find(line.c_str());
@@ -1411,7 +1411,7 @@ void cmSystemTools::Glob(const char *directory, const char *regexp,
if (d.Load(directory))
{
- int i, numf;
+ unsigned int i, numf;
numf = d.GetNumberOfFiles();
for (i = 0; i < numf; i++)
{
@@ -1441,7 +1441,7 @@ void cmSystemTools::GlobDirs(const char *fullPath,
cmDirectory d;
if (d.Load(startPath.c_str()))
{
- for (int i = 0; i < d.GetNumberOfFiles(); ++i)
+ for (unsigned int i = 0; i < d.GetNumberOfFiles(); ++i)
{
if((std::string(d.GetFile(i)) != ".")
&& (std::string(d.GetFile(i)) != ".."))
diff --git a/Templates/CMakeDotNetSystemConfig.cmake b/Templates/CMakeDotNetSystemConfig.cmake
index 2395dae..1e71371 100644
--- a/Templates/CMakeDotNetSystemConfig.cmake
+++ b/Templates/CMakeDotNetSystemConfig.cmake
@@ -3,11 +3,17 @@
SET (CMAKE_CXX_COMPILER cl CACHE STRING
"Name of C++ compiler used.")
-SET (CMAKE_CXX_FLAGS "/W3 /Zm1000 " CACHE STRING
- "Flags used by the compiler during all build types, /Zm1000 increases the compiler's memory allocation to support ANSI C++/stdlib")
+SET (CMAKE_CXX_FLAGS "/Zm1000 " CACHE STRING
+ "Flags used by the compiler during all build types, /Zm1000 increases the compiler's memory allocation to support ANSI C++/stdlib, /W3 sets the warning level to 3")
-SET (CMAKE_EXTRA_LINK_FLAGS "/STACK:10000000" CACHE STRING
- "Extra flags added to the link line for creation of exe and dlls.")
+SET (CMAKE_CXX_STACK_SIZE "10000000" CACHE STRING
+ "Size of stack for programs.")
+
+SET (CMAKE_CXX_WARNING_LEVEL "3" CACHE STRING
+ "Size of stack for programs.")
+
+SET (CMAKE_CXX_USE_RTTI 1 CACHE BOOL
+ "Compile CXX code with run time type information.")
SET (CMAKE_USE_WIN32_THREADS 1 CACHE BOOL
"Use the win32 thread library")
@@ -15,6 +21,9 @@ SET (CMAKE_USE_WIN32_THREADS 1 CACHE BOOL
SET (CMAKE_MAKE_PROGRAM "devenv" CACHE STRING
"Program used to build from dsp files.")
+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.")
+
# We will hardcode them for now. Make sure to fix that in the future
SET (CMAKE_SIZEOF_INT 4 CACHE INTERNAL "Size of int data type")
SET (CMAKE_SIZEOF_LONG 4 CACHE INTERNAL "Size of long data type")
@@ -27,7 +36,10 @@ SET (CMAKE_SIZEOF_DOUBLE 8 CACHE INTERNAL "Size of double data type")
# The following variables are advanced
MARK_AS_ADVANCED(
+CMAKE_CXX_USE_RTTI
CMAKE_CXX_COMPILER
+CMAKE_CXX_STACK_SIZE
+CMAKE_CXX_WARNING_LEVEL
CMAKE_USE_WIN32_THREADS
CMAKE_MAKE_PROGRAM
CMAKE_EXTRA_LINK_FLAGS