MantisBT - CMake
View Issue Details
0015648CMakeModulespublic2015-07-13 04:382016-01-04 11:51
Martin Baute 
Roger Leigh 
normalminoralways
closedfixed 
Windows
CMake 3.2.3 
CMake 3.4CMake 3.4 
0015648: FindXercesC.cmake does not work on Windows
The FindXercesC module shipping with CMake is rather simple. It looks for the Xerces-C library using this line:

find_library( XercesC_LIBRARY "xerces-c" DOC "Xerces-C++ libraries" )

This does not work on Windows -- here, the Xerces-C library is named xerces-c_3.lib (or ...-c_3D.lib for the debug build), making FindXercesC.cmake fail with "XercesC_LIBRARY-NOTFOUND".

Suggested fix would be using this line:

find_library( XercesC_LIBRARY NAMES xerces-c xerces-c_3 xerces-c_2 DOC "Xerces-C++ libraries" )
No tags attached.
Issue History
2015-07-13 04:38Martin BauteNew Issue
2015-07-13 05:09Roger LeighNote Added: 0039125
2015-07-13 06:21Martin BauteNote Added: 0039126
2015-07-13 07:01Roger LeighNote Added: 0039127
2015-07-13 07:06Roger LeighNote Added: 0039128
2015-07-13 07:46Martin BauteNote Added: 0039129
2015-07-13 09:08Brad KingAssigned To => Roger Leigh
2015-07-13 09:08Brad KingStatusnew => assigned
2015-07-13 09:11Brad KingNote Added: 0039131
2015-07-13 09:11Brad KingStatusassigned => resolved
2015-07-13 09:11Brad KingResolutionopen => fixed
2015-07-13 09:11Brad KingFixed in Version => CMake 3.4
2015-07-13 09:11Brad KingTarget Version => CMake 3.4
2016-01-04 11:51Robert MaynardNote Added: 0040092
2016-01-04 11:51Robert MaynardStatusresolved => closed

Notes
(0039125)
Roger Leigh   
2015-07-13 05:09   
Hi,

Note that I opened a PR to add xerces-c_3 last week; now merged to master.

I can also add xerces_c2 if that would be useful. Is this still actively used; is it not obsolete?


Regards,
Roger
(0039126)
Martin Baute   
2015-07-13 06:21   
I added xerces-c_2 just for completeness; who knows what kind of software still hasn't migrated to the new API. Version 2.8.0 is still offered for download from the archive site; I've verified its XercesVersion.hpp file to work with the version-retrieving RegEx in FindXercesC.cmake, so adding that one lib name should not hurt either way since stating minimum version with find_package( XercesC ) would still work.

Good to hear this hadn't espaced attention, keep on the excellent work!
(0039127)
Roger Leigh   
2015-07-13 07:01   
Should be fixed in: https://github.com/Kitware/CMake/pull/166 [^]
(0039128)
Roger Leigh   
2015-07-13 07:06   
I could also make it search for the debug libraries as well if that would be useful. However I'm not sure how well they will work--the upstream build files links against the release version of ICU, so they might be broken in practice.
(0039129)
Martin Baute   
2015-07-13 07:46   
I found the debug library issue to be rather fickle on Windows in any case -- Boost and ICU is another such murky corner -- and have basically given up on trying to compile debug code on Windows altogehter.
(0039131)
Brad King   
2015-07-13 09:11   
I've merged the patch from 0015648:0039127:

 FindXercesC: Also search for xerces-c_2
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=38ddabb1 [^]
(0040092)
Robert Maynard   
2016-01-04 11:51   
Closing resolved issues that have not been updated in more than 4 months.