[CMake] Explicit <NAME>_LIBRARIES and <NAME>_INCLUDE_DIRS

Andreas Stahl andreas.stahl at tu-dresden.de
Fri Mar 22 17:25:48 EDT 2013





Am 22.03.2013 um 16:59 schrieb Mateusz Loskot <mateusz at loskot.net>:

> Hi,
> 
> I'm trying to build software which uses libE57 library which has
> Xerces as dependency.
> I build Xerces too as part of my project and I deploy it in custom locations
> and Xerces library has custom name.
> 
> libE57 provides FindXerces.cmake [1] and I've been trying to figure
> out how I can
> make this module find Xerces I provide, I tried to explicitly the two variables:
> Xerces_INCLUDE_DIR
> Xerces_LIBRARY
> on invocation of cmake, but obviously this FindXerces.cmake is still nagging me
> about XERCES_ROOT
> 
> This is first time when I have to deal with CMake-based software and custom
> names and locations of libraries, so I'm not sure either I'm missing some
> important tricks here or this FindXerces.cmake is just poorly written module
> and it does not check if user passes <NAME>_INCLUDE or <NAME>_LIBRARY directly.
> 
> I know I can also use CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH,
> but how to deal with custom library names, when this module expects
> two options only [2].
> 
> Could anyone advise about workaround?
> 
> Is this an issue in the FindXerces.cmake and would you say it's worth
> to submit bug report to libE57?
> 
> [1] http://sourceforge.net/p/e57-3d-imgfmt/code/331/tree/trunk/cmake/Modules/FindXerces.cmake
> [2] http://sourceforge.net/p/e57-3d-imgfmt/code/331/tree/trunk/cmake/Modules/FindXerces.cmake#l44
> 
> Best regards,

Hi mateusz,

Try setting the environment variable set($ENV{XERCES_ROOT} /path/to/xerces) to the directory where you installed the library, before you call find_package. That should be enough. 
Best Regards,

Andreas


More information about the CMake mailing list