[Cmake] RE: FindXerces.cmake

Wheeler, Frederick W (Research) wheeler at crd.ge.com
Thu May 15 15:16:58 EDT 2003


I've greatly enhanced the FindXerces.cmake file I sent to this list this
morning.  The new version is below.

If there should be a FindXerces.cmake in CMake/Modules, and this could be
it, let me know if there is anything else I can do to it.

-Fred Wheeler

#
# Find the native Xerces includes and library
#
# XERCES_INCLUDE_DIR - where to find dom/dom.hpp, etc.
# XERCES_LIBRARIES   - List of fully qualified libraries to link against
when using Xerces.
# XERCES_VERSION_1   - Use this Version
# XERCES_VERSION_2   - Use this Version
# XERCES_FOUND       - Do not attempt to use Xerces if "no" or undefined.

OPTION(XERCES_VERSION_1 "Use Xerces version 1.x" 0)
OPTION(XERCES_VERSION_2 "Use Xerces version 2.x" 1)

# Exclusion between the versions

IF(XERCES_VERSION_2)
  SET(XERCES_VERSION_1 0)
ENDIF(XERCES_VERSION_2)

FIND_PATH(XERCES_INCLUDE_DIR dom/dom.hpp
  /usr/local/include
  /usr/include
)

# Make sure that the Xerces include path has been set
# So the XERCES_LIBRARY does not appear the first time
IF(XERCES_INCLUDE_DIR)
  IF(XERCES_VERSION_1)
    FIND_LIBRARY(XERCES_LIBRARY
      NAMES
        xerces-c_1
        xerces-c_1D
      PATHS
        /usr/local/lib
        /usr/lib
        ${XERCES_INCLUDE_DIR}/../lib
    )
  ENDIF(XERCES_VERSION_1)
  IF(XERCES_VERSION_2)
    FIND_LIBRARY(XERCES_LIBRARY
      NAMES
        xerces-c_2
        xerces-c_2D
      PATHS
        /usr/local/lib
        /usr/lib
        ${XERCES_INCLUDE_DIR}/../lib
    )
  ENDIF(XERCES_VERSION_2)
ENDIF(XERCES_INCLUDE_DIR)

IF(XERCES_INCLUDE_DIR)
  IF(XERCES_LIBRARY)
    SET( XERCES_LIBRARIES ${XERCES_LIBRARY} )
    SET( XERCES_FOUND "YES" )
  ENDIF(XERCES_LIBRARY)
ENDIF(XERCES_INCLUDE_DIR)

MARK_AS_ADVANCED(
  XERCES_VERSION_1
  XERCES_VERSION_2
)




More information about the CMake mailing list