MantisBT - CMake
View Issue Details
0015475CMakeCPackpublic2015-03-25 20:292015-11-02 09:13
Daniel Schepler 
Nils Gladitz 
normalminoralways
closedfixed 
CMake 3.2.1 
CMake 3.3CMake 3.3 
0015475: Fails to build against external Expat 2.1.0 with Visual Studio 2013
When I try to build CMake 3.2.1 using external Expat 2.1.0 (and also external ZLib 1.2.8) using Visual Studio 2013 (Express Edition), I get this error:

C:\tools\cygwin\home\dschepler\scalable-dev\scalable-3p\scalable-3p-cmake\Source
\CPack\WiX\cmWIXPatchParser.cxx(135) : error C2664: 'XML_Size XML_GetCurrentLine
Number(XML_Parser)' : cannot convert argument 1 from 'void *' to 'XML_Parser'
        Conversion from 'void*' to pointer to non-'void' requires an explicit ca
st
C:\tools\cygwin\home\dschepler\scalable-dev\scalable-3p\scalable-3p-cmake\Source
\CPack\WiX\cmWIXPatchParser.cxx(136) : error C2664: 'XML_Size XML_GetCurrentColu
mnNumber(XML_Parser)' : cannot convert argument 1 from 'void *' to 'XML_Parser'
        Conversion from 'void*' to pointer to non-'void' requires an explicit ca
st
C:\tools\cygwin\home\dschepler\scalable-dev\scalable-3p\scalable-3p-cmake\Source
\CPack\WiX\cmWIXPatchParser.cxx(137) : error C2660: 'cmWIXPatchParser::ReportErr
or' : function does not take 2 arguments
NMAKE : fatal error U1077: 'C:\PROGRA~2\MICROS~1.0\VC\bin\X86_AM~1\cl.exe' : ret
urn code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0
\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0
\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
The command line I used to configure the build was:

cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=C:\tools\cygwin\home\dschepler\scalable-dev\scalable-3p\scalable-3p-cmake\image -DCMAKE_USE_SYSTEM_EXPAT:BOOL=ON -DCMAKE_USE_SYSTEM_ZLIB:BOOL=ON -DBUILD_QtDialog:BOOL=ON ..

Then running nmake in the build directory gave the error.

And incidentally, it found Expat and ZLib through paths included in the CMAKE_PREFIX_PATH environment variable; while as usual, Qt 4 was found through qmake being on PATH.
With the attached patch, I was able to complete the build, and the install image looked good. I don't know if this is the best solution, or whether it might be better to change cmXMLParser to have "XML_Parser Parser;" instead of "void* Parser;".
No tags attached.
diff fix-build-against-expat-2.1.0.diff (614) 2015-03-25 20:29
https://public.kitware.com/Bug/file/5412/fix-build-against-expat-2.1.0.diff
Issue History
2015-03-25 20:29Daniel ScheplerNew Issue
2015-03-25 20:29Daniel ScheplerFile Added: fix-build-against-expat-2.1.0.diff
2015-03-26 08:54Brad KingAssigned To => Nils Gladitz
2015-03-26 08:54Brad KingStatusnew => assigned
2015-03-26 08:54Brad KingTarget Version => CMake 3.3
2015-03-26 12:00Nils GladitzNote Added: 0038332
2015-03-26 13:35Daniel ScheplerNote Added: 0038333
2015-03-27 09:31Nils GladitzNote Added: 0038347
2015-03-27 09:31Nils GladitzStatusassigned => resolved
2015-03-27 09:31Nils GladitzFixed in Version => CMake 3.3
2015-03-27 09:31Nils GladitzResolutionopen => fixed
2015-11-02 09:13Robert MaynardNote Added: 0039748
2015-11-02 09:13Robert MaynardStatusresolved => closed

Notes
(0038332)
Nils Gladitz   
2015-03-26 12:00   
Thank you for the report.

I am not sure what the best way is either but I duplicated the existing work-around present in e.g. cmXMLParser.cxx and merged it to next for testing:

http://www.cmake.org/gitweb?p=cmake.git;a=commit;h=8603791553965de4d80a42347022dec1fbd8cd98 [^]

Please try it out and report back if it works for you.
(0038333)
Daniel Schepler   
2015-03-26 13:35   
With that patch, the build worked fine, and the testsuite passed (except for CMake.CheckSourceTree which failed because I was using a private git repository with non-committed changes; and ExportImport which gave some error about not being able to write expAbs-debug.cmake).
(0038347)
Nils Gladitz   
2015-03-27 09:31   
Thanks for testing.
The commit has been merged to master.
(0039748)
Robert Maynard   
2015-11-02 09:13   
Closing resolved issues that have not been updated in more than 4 months.