]> granicus.if.org Git - check/commitdiff
example: Add CHECK_INSTALL_DIR override for FindCheck.cmake
authorbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Wed, 5 Feb 2014 16:08:00 +0000 (16:08 +0000)
committerbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Wed, 5 Feb 2014 16:08:00 +0000 (16:08 +0000)
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

doc/example/cmake/FindCheck.cmake

index a7cd11a7d424918a3fd784dd3ef244b789102efa..4392d88986e668a9a4e455fa4322cd0f4fa8e8c2 100644 (file)
@@ -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 )