[CMake] Expat problem

eddy xu eddyxu at gmail.com
Wed Oct 17 19:42:13 EDT 2007


Hi all,

When I try to generate Makefile on a gentoo box, one error message comes
out:

CMake Error: expat_DIR is not set. It must be set to the directory
containing expatConfig.cmake in order to use expat.

And I can not get any meaningful help from google the keyword "expatConfig".
Can any one gives some advices?

My CMakeList.txt is below:


SET( SRCS XML_Node.cpp XML_Parser_Base.cpp )

IF ( WIN32 )
        set ( EXPAT_LIBRARY "c:\\work\\expat\\Source\\lib" )
        set ( EXPAT_INCLUDE_DIR "c:\\work\\expat\\Source\\lib" )

        set ( SRCS ${SRCS} XML_Win32_Parser.cpp XML_Win32_Parser.h )
        set ( SRCS ${SRCS} XML_Parser_Base.h XML_Node.h
                )
ENDIF ( WIN32 )

ADD_LIBRARY ( qlibxml SHARED ${SRCS} )


IF ( ${CMAKE_SYSTEM} MATCHES Linux OR ${CMAKE_SYSTEM} MATCHES Darwin OR
${CMAKE_SYSTEM} MATCHES Freebsd )

        MESSAGE ( STATUS "Configure in Unix" )
        set ( SRCS ${SRCS} XML_Stream_Parser.cpp )

        # check for expat
        FIND_PACKAGE ( expat REQUIRED )
        IF ( EXPAT_FOUND )
                INCLUDE_DIRECTORIES ( ${EXPAT_INCLUDE_DIRS} )
                TARGET_LINK_LIBRARIES ( qlibxml ${EXPAT_LIBRARIES} )
        ELSE ( EXPAT_FOUND )
                MESSAGE( FATAL_ERROR "No expat installed" )
        ENDIF( EXPAT_FOUND )

ENDIF ( ${CMAKE_SYSTEM} MATCHES Linux OR ${CMAKE_SYSTEM} MATCHES Darwin OR
${CMAKE_SYSTEM} MATCHES Freebsd )


And the expat configure part works fine on Mac OS X ( which kernel names
Darwin )

Thanks for all advices!

Eddy Xu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20071018/0205c7a8/attachment.htm


More information about the CMake mailing list