Cdroid/cmake/modules/FindEXPAT.cmake

28 lines
804 B
CMake
Executable File

find_package(PkgConfig)
pkg_check_modules(PC_EXPAT expat)
find_path(EXPAT_INCLUDE_DIR
NAMES expat.h
HINTS ${PC_EXPAT_INCLUDE_DIRS}
${PC_EXPAT_INCLUDEDIR}
)
find_library(EXPAT_LIBRARY
NAMES expat expatd
HINTS ${PC_EXPAT_LIBDIR}
${PC_EXPAT_LIBRARY_DIRS}
)
if(EXPAT_INCLUDE_DIR AND EXPAT_LIBRARY)
set(EXPAT_FOUND TRUE)
set(EXPAT_INCLUDE_DIRS ${EXPAT_INCLUDE_DIR})
set(EXPAT_LIBRARIES ${EXPAT_LIBRARY})
set(EXPAT_VERSION ${PC_EXPAT_VERSION})
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(EXPAT FOUND_VAR EXPAT_FOUND VERSION_VAR EXPAT_VERSION
REQUIRED_VARS EXPAT_LIBRARIES EXPAT_LIBRARY EXPAT_INCLUDE_DIRS EXPAT_INCLUDE_DIR)
mark_as_advanced(EXPAT_LIBRARIES EXPAT_LIBRARY EXPAT_INCLUDE_DIRS EXPAT_INCLUDE_DIR)
endif()