[CMake] CMake 2.4.2 generates undebuggable .vcproj projects.
Joshua Jensen
jjensen at workspacewhiz.com
Thu May 24 12:52:39 EDT 2007
Bill Hoffman wrote:
> Rob Mathews wrote:
>> To reproduce, take CMake 2.4.1 from CVS and build it.
>> Open the CMake.sln file, right click on CMake project, choose
>> properties.
>> Look Properties->C/C++->General tag, the "Debug Information Format"
>> field. It says "Disabled".
> Does it work in CMake 2.4.6?
> Strange, but I am pretty sure many folks here at Kitware are debugging
> with no problem.
It works properly out of CVS (and as I recall, 2.4.6), although it is
hardcoded to the Debug and RelWithDebugInfo configurations. The
attached patch against latest CVS allows non-hardcoded configurations in
Visual Studio 7 and 8 and allows debugging of any configuration whose
linker line contains /DEBUG.
Josh
------
--- Modules/Platform/Windows-cl.cmake Fri May 18 11:09:41 2007
+++ Modules/Platform/Windows-cl.cmake Thu May 24 02:44:29 2007
@@ -226,20 +226,20 @@
# set the stack size and the machine type
IF(CMAKE_CL_64)
SET (CMAKE_EXE_LINKER_FLAGS_INIT
- "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:x64")
+ "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /MACHINE:X64")
ELSE(CMAKE_CL_64)
SET (CMAKE_EXE_LINKER_FLAGS_INIT
- "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:I386")
+ "${CMAKE_EXE_LINKER_FLAGS_INIT} /MACHINE:X86")
ENDIF(CMAKE_CL_64)
-# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add
pdbtyp
+# add /DEBUG and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add
pdbtyp
# on versions that support it
IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
- SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept
/INCREMENTAL:YES")
- SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept
/INCREMENTAL:YES")
+ SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/DEBUG /PDBTYPE:sept
/INCREMENTAL:YES")
+ SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/DEBUG /PDBTYPE:sept
/INCREMENTAL:YES")
ELSE (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
- SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /INCREMENTAL:YES")
- SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug
/INCREMENTAL:YES")
+ SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/DEBUG /INCREMENTAL:YES")
+ SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/DEBUG
/INCREMENTAL:YES")
ENDIF (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
# for release and minsize release default to no incremental linking
SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT "/INCREMENTAL:NO")
--- Source/cmGlobalVisualStudio7Generator.cxx Thu May 24 02:17:48 2007
+++ Source/cmGlobalVisualStudio7Generator.cxx Thu May 24 02:46:30 2007
@@ -168,8 +168,8 @@
len = configTypes.size() - start;
}
config = configTypes.substr(start, len);
- if(config == "Debug" || config == "Release" ||
- config == "MinSizeRel" || config == "RelWithDebInfo")
+// if(config == "Debug" || config == "Release" ||
+// config == "MinSizeRel" || config == "RelWithDebInfo")
{
// only add unique configurations
if(std::find(this->Configurations.begin(),
@@ -179,13 +179,13 @@
this->Configurations.push_back(config);
}
}
- else
+/* else
{
cmSystemTools::Error(
"Invalid configuration type in CMAKE_CONFIGURATION_TYPES: ",
config.c_str(),
" (Valid types are Debug,Release,MinSizeRel,RelWithDebInfo)");
- }
+ }*/
start = endpos+1;
}
}
--- Source/cmLocalVisualStudio7Generator.cxx Thu May 24 02:17:49 2007
+++ Source/cmLocalVisualStudio7Generator.cxx Thu May 24 02:47:54 2007
@@ -347,6 +347,10 @@
cmVS7FlagTable::UserValue},
{"IgnoreAllDefaultLibraries", "NODEFAULTLIB", "ignore all default libs",
"TRUE", 0},
+ {"OptimizeReferences", "OPT:REF", "optimize references", "2", 0},
+ {"EnableCOMDATFolding", "OPT:ICF", "enable comdat folding", "2", 0},
+ {"GenerateDebugInformation", "DEBUG", "debug support", "TRUE", 0},
+ {"TargetMachine", "MACHINE:X86", "x86 support", "1", 0},
{0,0,0,0,0}
};
@@ -757,11 +761,11 @@
temp += targetNamePDB;
fout << "\t\t\t\tProgramDataBaseFile=\"" <<
this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
- if(strcmp(configName, "Debug") == 0
+/* if(strcmp(configName, "Debug") == 0
|| strcmp(configName, "RelWithDebInfo") == 0)
{
fout << "\t\t\t\tGenerateDebugInformation=\"TRUE\"\n";
- }
+ }*/
std::string stackVar = "CMAKE_";
stackVar += linkLanguage;
stackVar += "_STACK_SIZE";
@@ -831,11 +835,11 @@
fout << "\t\t\t\tProgramDataBaseFile=\""
<< target.GetDirectory(configName) << "/" << targetNamePDB
<< "\"\n";
- if(strcmp(configName, "Debug") == 0
+/* if(strcmp(configName, "Debug") == 0
|| strcmp(configName, "RelWithDebInfo") == 0)
{
fout << "\t\t\t\tGenerateDebugInformation=\"TRUE\"\n";
- }
+ }*/
if ( target.GetPropertyAsBool("WIN32_EXECUTABLE") )
{
fout << "\t\t\t\tSubSystem=\"2\"\n";
@@ -1725,7 +1729,7 @@
if(flag[0] == '-' || flag[0] == '/')
{
// Look for preprocessor definitions.
- if(flag[1] == 'D')
+ if(flag[1] == 'D' && this->FlagTable !=
cmLocalVisualStudio7GeneratorLinkFlagTable)
{
if(flag[2] == '\0')
{
More information about the CMake
mailing list