[CMake] FIND_LIBRARY sometimes not working as expected ?

Koen Deforche koen.deforche at gmail.com
Mon Jan 15 03:36:10 EST 2007


Hello,

As author of the Wt library, I have adopted cmake since a few months as build
system. However, I have problems with creating CMakeLists.txt which works for
users on different operating systems, including debian, ubuntu and fedora core.

For example, a fragment that causes trouble where I want to find the Xerces C++
library::

...

FIND_LIBRARY(XERCES_CPP_LIB
NAMES
 xerces-c xerces-c_2 xerces-c_static_2
PATHS
 /usr/lib
 /usr/local/lib
 ${USERLIB_ROOT}/lib
 c:/libraries/lib
)

FIND_PATH(XERCES_CPP_INCLUDE xercesc/util/PlatformUtils.hpp
 /usr/include
 /usr/local/include
 ${USERLIB_ROOT}/include
 c:/tmp/witty/xerces-c-src_2_7_0/src
)

IF(NOT EXISTS ${XERCES_CPP_LIB} OR NOT EXISTS ${XERCES_CPP_INCLUDE})
 MESSAGE("** Error finding Wt required library: ")
 MESSAGE(FATAL_ERROR "** Wt requires the Xerces-C++ XML parser library.")
ENDIF(NOT EXISTS ${XERCES_CPP_LIB} OR NOT EXISTS ${XERCES_CPP_INCLUDE})

...

Fedora Core 4, this results in the error message ("** Wt requires the
Xerces-C++ XML parser library.") and the entry in the CMakeCache.txt:

XERCES_CPP_LIB:FILEPATH=XERCES_CPP_LIB-NOTFOUND

However, they do have the library installed at exactly the same place with the
same name as I have on my systems:

$ yum list installed
xerces-c.i386                            2.7.0-1.2.fc4.rf       installed
xerces-c-debuginfo.i386                  2.7.0-1.2.fc4.rf       installed
xerces-c-devel.i386                      2.7.0-1.2.fc4.rf       installed

$ rpm -ql xerces-c
...
/usr/lib/libxerces-c.so.27
...

$ rpm -ql xerces-c-devel
...
/usr/lib/libxerces-c.so
...

They are using a more recent version of cmake:

$ cmake --version
cmake version 2.4-patch 5

While the most recent version I am using is:
$ cmake --version
cmake version 2.4-patch 2

I cannot figure out how to change the CMakeLists.txt to get a correct build ?

If you want to check for yourself, you can download the latest CVS
snapshot using:

cvs -z3 -d:pserver:anonymous at witty.cvs.sourceforge.net:/cvsroot/witty co -P wt
cd wt
mkdir build
cd build
cmake ../

Any suggestions are kindly appreciated,
Regards,
koen


More information about the CMake mailing list