From: brarcher Date: Wed, 5 Feb 2014 16:08:00 +0000 (+0000) Subject: example: Add CHECK_INSTALL_DIR override for FindCheck.cmake X-Git-Tag: 0.10.0~122 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0bdf53069ba81479586e5422e07cf27e66abd86f;p=check example: Add CHECK_INSTALL_DIR override for FindCheck.cmake If pkg-config is not installed on the system, then the FindCheck.cmake script may fail. This is especially likely on Windows. In this case, we expect that the variable CHECK_INSTALL_DIR points to the install location of Check. If this variable is not defined, then the find_path() and find_library() functions will try to locate Check the best that it can. git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@1095 64e312b2-a51f-0410-8e61-82d0ca0eb02a --- diff --git a/doc/example/cmake/FindCheck.cmake b/doc/example/cmake/FindCheck.cmake index a7cd11a..4392d88 100644 --- a/doc/example/cmake/FindCheck.cmake +++ b/doc/example/cmake/FindCheck.cmake @@ -24,10 +24,17 @@ PKG_SEARCH_MODULE( CHECK check ) # Look for CHECK include dir and libraries IF( NOT CHECK_FOUND ) - - FIND_PATH( CHECK_INCLUDE_DIR check.h ) - - FIND_LIBRARY( CHECK_LIBRARIES NAMES check ) + IF ( CHECK_INSTALL_DIR ) + MESSAGE ( STATUS "Using override CHECK_INSTALL_DIR to find check" ) + SET ( CHECK_INCLUDE_DIR "${CHECK_INSTALL_DIR}/include" ) + SET ( CHECK_INCLUDE_DIRS "${CHECK_INCLUDE_DIR}" ) + FIND_LIBRARY( CHECK_LIBRARY NAMES check PATHS "${CHECK_INSTALL_DIR}/lib" ) + FIND_LIBRARY( COMPAT_LIBRARY NAMES compat PATHS "${CHECK_INSTALL_DIR}/lib" ) + SET ( CHECK_LIBRARIES "${CHECK_LIBRARY}" "${COMPAT_LIBRARY}" ) + ELSE ( CHECK_INSTALL_DIR ) + FIND_PATH( CHECK_INCLUDE_DIR check.h ) + FIND_LIBRARY( CHECK_LIBRARIES NAMES check ) + ENDIF ( CHECK_INSTALL_DIR ) IF ( CHECK_INCLUDE_DIR AND CHECK_LIBRARIES ) SET( CHECK_FOUND 1 )