From 6ec49de42ff99401dcfa4fde22562005bbce542d Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Mon, 28 Jan 2013 20:09:23 +0100 Subject: [PATCH] CMake cross compile fixes for libexpat find package. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59733 --- cmake/modules/FindLibExpat.cmake | 26 +++++++++++++++++--------- 1 Datei geändert, 17 Zeilen hinzugefügt(+), 9 Zeilen entfernt(-) diff --git a/cmake/modules/FindLibExpat.cmake b/cmake/modules/FindLibExpat.cmake index a07c8de..f1fd152 100644 --- a/cmake/modules/FindLibExpat.cmake +++ b/cmake/modules/FindLibExpat.cmake @@ -12,24 +12,32 @@ if (LIBEXPAT_INCLUDE_DIR AND LIBEXPAT_LIBRARIES) SET(LIBEXPAT_FOUND TRUE) else (LIBEXPAT_INCLUDE_DIR AND LIBEXPAT_LIBRARIES) - - IF (WIN32) - file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _progFiles) - find_FILE(LIBEXPAT_DIR expat Source/lib/expat.h - PATHS - "${_progFiles}" - ) + if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") + file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _progFiles) + find_FILE(LIBEXPAT_DIR expat Source/lib/expat.h + PATHS + "${_progFiles}" + ) if (LIBEXPAT_DIR) set (_LIBEXPATIncDir ${LIBEXPAT_DIR}/Source/lib) set (_LIBEXPATLinkDir ${LIBEXPAT_DIR}/libs) endif (LIBEXPAT_DIR) - ELSE (WIN32) + elseif (CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_CROSSCOMPILING) + find_FILE(LIBEXPAT_DIR include/expat.h + PATHS + ${CMAKE_FIND_ROOT_PATH} + ) + if (LIBEXPAT_DIR) + set (_LIBEXPATIncDir ${LIBEXPAT_DIR}/include) + set (_LIBEXPATLinkDir ${LIBEXPAT_DIR}/lib) + endif (LIBEXPAT_DIR) + else () # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls INCLUDE(UsePkgConfig) PKGCONFIG(LIBEXPAT-2.0 _LIBEXPATIncDir _LIBEXPATLinkDir _LIBEXPATLinkFlags _LiIconvCflags) SET(LIBEXPAT_DEFINITIONS ${_LIBEXPATCflags}) - ENDIF (WIN32) + endif () FIND_PATH(LIBEXPAT_INCLUDE_DIR expat.h PATHS -- 1.7.10.4