FindThirdPartyExpat.cmake 1.71 KB
Newer Older
Jozef Legeny's avatar
Jozef Legeny committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
# ---------------------------------
# Finds EXPAT toolkit
#
# Sets EXPAT_FOUND
# Sets EXPAT_LIBRARIES
# Sets EXPAT_LIBRARY_DIRS
# Sets EXPAT_LDFLAGS
# Sets EXPAT_LDFLAGS_OTHERS
# Sets EXPAT_INCLUDE_DIRS
# Sets EXPAT_CFLAGS
# Sets EXPAT_CFLAGS_OTHERS
# ---------------------------------
IF(UNIX)
	FIND_PATH(EXPAT_expat_INCLUDE_PATH "expat.h"
		PATHS "${OV_CUSTOM_DEPENDENCIES_PATH}/include")
	FIND_LIBRARY(EXPAT_expat_LIBRARY
		NAMES expat
		PATHS "${OV_CUSTOM_DEPENDENCIES_PATH}/lib")
ENDIF(UNIX)

IF(WIN32)
	FIND_PATH(EXPAT_expat_INCLUDE_PATH "expat.h"
		PATHS "${OV_CUSTOM_DEPENDENCIES_PATH}/expat/Source/lib")
	FIND_LIBRARY(EXPAT_expat_LIBRARY
		NAMES libexpat
		PATHS "${OV_CUSTOM_DEPENDENCIES_PATH}/expat/Libs" "${OV_CUSTOM_DEPENDENCIES_PATH}/expat/Bin")
ENDIF(WIN32)

IF(EXPAT_expat_INCLUDE_PATH)
IF(EXPAT_expat_LIBRARY)
	SET(EXPAT_FOUND TRUE)
	SET(EXPAT_LIBRARIES ${EXPAT_expat_LIBRARY})
	SET(EXPAT_LIBRARY_DIRS "")
	SET(EXPAT_LDFLAGS "")
	SET(EXPAT_LDFLAGS_OTHERS "")
	SET(EXPAT_INCLUDE_DIRS ${EXPAT_expat_INCLUDE_PATH})
	SET(EXPAT_CFLAGS "")
	SET(EXPAT_CFLAGS_OTHERS "")
ENDIF(EXPAT_expat_LIBRARY)
ENDIF(EXPAT_expat_INCLUDE_PATH)

MARK_AS_ADVANCED(
	EXPAT_expat_INCLUDE_PATH
	EXPAT_expat_LIBRARY

	EXPAT_FOUND
	EXPAT_LIBRARIES
	EXPAT_LIBRARY_DIRS
	EXPAT_LDFLAGS
	EXPAT_LDFLAGS_OTHERS
	EXPAT_INCLUDE_DIRS
	EXPAT_CFLAGS
	EXPAT_CFLAGS_OTHERS
)

IF(EXPAT_FOUND)
	MESSAGE(STATUS "  Found expat...")
	INCLUDE_DIRECTORIES(${EXPAT_INCLUDE_DIRS})
	ADD_DEFINITIONS(${EXPAT_CFLAGS})
	ADD_DEFINITIONS(${EXPAT_CFLAGS_OTHERS})
	# LINK_DIRECTORIES(${EXPAT_LIBRARY_DIRS})
	TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${EXPAT_LIBRARIES})

	ADD_DEFINITIONS(-DTARGET_HAS_ThirdPartyExpat)
ELSE(EXPAT_FOUND)
	MESSAGE(STATUS "  FAILED to find expat...")
ENDIF(EXPAT_FOUND)