MantisBT - CMake
View Issue Details
0011230CMakeQtDialogpublic2010-09-14 02:022010-10-06 13:39
EricG 
Ben Boeckel 
normalcrashalways
closedfixed 
CMake-2-8 
CMake 2.8.3CMake 2.8.3 
0011230: CMake 2.8.2 crashes when adding a library with only header files
If I add a subdirectory to my CMake project that adds a library having only header files, then CMake crashes when attempting when I click 'Generate'. I've attached a simple reproduction.
CMake 2.8.2 GUI on Windows 7 32-bit
Generating a Visual Studio 2010 solution
No tags attached.
zip test.zip (638) 2010-09-14 02:02
https://public.kitware.com/Bug/file/3384/test.zip
Issue History
2010-09-14 02:02EricGNew Issue
2010-09-14 02:02EricGFile Added: test.zip
2010-09-14 07:06David ColeStatusnew => assigned
2010-09-14 07:06David ColeAssigned To => Ben Boeckel
2010-09-14 07:06David ColeNote Added: 0022215
2010-09-14 14:32EricGNote Added: 0022220
2010-09-14 14:34David ColeNote Added: 0022221
2010-09-14 16:21Ben BoeckelNote Added: 0022222
2010-09-16 15:20EricGNote Added: 0022260
2010-09-30 09:24Brad KingNote Added: 0022390
2010-09-30 09:25Brad KingStatusassigned => closed
2010-09-30 09:25Brad KingResolutionopen => fixed
2010-10-06 13:39David ColeFixed in Version => CMake 2.8.3
2010-10-06 13:39David ColeTarget Version => CMake 2.8.3

Notes
(0022215)
David Cole   
2010-09-14 07:06   
Clearly, a potential work-around would be to add a "dummy.c" source file to any such library until a fix is ready...
(0022220)
EricG   
2010-09-14 14:32   
set_source_files_properties(... PROPERTIES LANGUAGE CXX) also works. It's more of the surprise of the interface crashing that was unexpected.
(0022221)
David Cole   
2010-09-14 14:34   
Sure... there's no way it should crash. It should absolutely be fixed ASAP.
(0022222)
Ben Boeckel   
2010-09-14 16:21   
Does this only occur with the GUI or does the command line call also crash? A backtrace would also help.
(0022260)
EricG   
2010-09-16 15:20   
This also happens with the command line. I'm not sure if it's the same crash. It crashes for me here:
     cmake.exe!std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::begin() Line 782 + 0x7 bytes C++
> cmake.exe!cmVisualStudioGeneratorOptions::UsingUnicode() Line 107 + 0x18 bytes C++
     cmake.exe!cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() Line 252 + 0x50 bytes C++
     cmake.exe!cmVisualStudio10TargetGenerator::Generate() Line 164 C++
     cmake.exe!cmLocalVisualStudio10Generator::Generate() Line 100 C++
     cmake.exe!cmGlobalGenerator::Generate() Line 888 + 0x2c bytes C++
     cmake.exe!cmGlobalVisualStudioGenerator::Generate() Line 86 C++
     cmake.exe!cmGlobalVisualStudio7Generator::Generate() Line 192 C++
     cmake.exe!cmGlobalVisualStudio8Generator::Generate() Line 244 C++
     cmake.exe!cmake::Generate() Line 2298 + 0x1b bytes C++
     cmake.exe!cmakewizard::RunWizard(const std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > & args) Line 152 + 0xb bytes C++
     cmake.exe!do_cmake(int ac, char * * av) Line 489 + 0x12 bytes C++
     cmake.exe!main(int ac, char * * av) Line 318 + 0xd bytes C++
     cmake.exe!__tmainCRTStartup() Line 555 + 0x19 bytes C
     cmake.exe!mainCRTStartup() Line 371 C

The crash seems to be caused by this->Defines.begin() where this is null.
(0022390)
Brad King   
2010-09-30 09:24   
My bad. The ClOptions map is left empty in this case but later code assumes it has been filled. We should just abort generation in this case. Fixed:

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=448661fb [^]