- refactor FindCheck
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Mon, 20 Oct 2008 13:49:27 +0000 (13:49 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Mon, 20 Oct 2008 13:49:27 +0000 (13:49 +0000)
- Use FindZLib
- Still can't figure out why required does not work

CMakeLists.txt
cmake/modules/FindCheck.cmake

index 71f5e15a062a69f8717ed857905add11e2caa5a9..e1c8e43a16fd110cdf76480185dff16e64d0d3e0 100644 (file)
@@ -33,9 +33,9 @@ INCLUDE( ${CMAKE_SOURCE_DIR}/VERSION.cmake )
 
 FIND_PACKAGE(EXPAT REQUIRED)
 FIND_PACKAGE(Check REQUIRED)
+FIND_PACKAGE(ZLIB REQUIRED)
 
 FIND_LIBRARY(RPMDB_LIBRARY NAMES rpmdb)
-FIND_LIBRARY(ZLIB_LIBRARY NAMES z)
 
 SET( PACKAGE "satsolver" )
 SET( VERSION "${LIBSATSOLVER_MAJOR}.${LIBSATSOLVER_MINOR}.${LIBSATSOLVER_PATCH}" )
@@ -43,9 +43,7 @@ SET( VERSION "${LIBSATSOLVER_MAJOR}.${LIBSATSOLVER_MINOR}.${LIBSATSOLVER_PATCH}"
 ADD_DEFINITIONS( -D_FILE_OFFSET_BITS=64 )
 ADD_DEFINITIONS( -DVERSION=\\\"${VERSION}\\\" )
 
-
-
-SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "mls solver")
+SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "SAT Solver library")
 SET(CPACK_PACKAGE_VENDOR "Novell Inc.")
 SET(CPACK_PACKAGE_VERSION_MAJOR ${LIBSATSOLVER_MAJOR})
 SET(CPACK_PACKAGE_VERSION_MINOR ${LIBSATSOLVER_MINOR})
@@ -111,10 +109,10 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR} ${CMAKE_SOU
 ####################################################################
 
 MESSAGE(STATUS "Looking modules in ${CMAKE_MODULE_PATH}")
-FIND_PROGRAM(SWIG_EXECUTABLE
-  NAMES swig-1.3 swig
-  PATHS ${SWIG_DIR} ${SWIG_DIR}/.. ${SWIG_DIR}/../../bin /usr/bin /usr/local/bin ${CMAKE_INSTALL_PREFIX}/bin
-)
+#FIND_PROGRAM(SWIG_EXECUTABLE
+#  NAMES swig-1.3 swig
+#  PATHS ${SWIG_DIR} ${SWIG_DIR}/.. ${SWIG_DIR}/../../bin /usr/bin /usr/local/bin ${CMAKE_INSTALL_PREFIX}/bin
+#)
 
 set ( CMAKE_C_FLAGS     "${CMAKE_C_FLAGS} -Werror -Wall" )
 set ( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -g -O3" )
@@ -125,12 +123,14 @@ ADD_SUBDIRECTORY(tools)
 ADD_SUBDIRECTORY(applayer)
 ADD_SUBDIRECTORY(tests)
 
-IF ( NOT SWIG_EXECUTABLE )
+FIND_PACKAGE(SWIG REQUIRED)
+
+IF ( NOT SWIG_FOUND )
   MESSAGE( FATAL "SWIG not found." )
-ELSE ( NOT SWIG_EXECUTABLE )
+ELSE ( NOT SWIG_FOUND )
   MESSAGE( STATUS "SWIG found at ${SWIG_EXECUTABLE}" )
   ADD_SUBDIRECTORY(bindings)
-ENDIF ( NOT SWIG_EXECUTABLE )
+ENDIF ( NOT SWIG_FOUND )
 
 MESSAGE(STATUS "version: ${VERSION}")
 
@@ -183,3 +183,5 @@ ADD_CUSTOM_TARGET( srcpackage
 
 INCLUDE(CTest)
 ENABLE_TESTING()
+
+
index bcc0e5b638abf40956e1ce0e0c1342b430b62882..c40bfbf5067109d18202e057e40ef15a1c0b6815 100644 (file)
@@ -1,33 +1,24 @@
 
+IF (CHECK_INCLUDE_DIR)
+  # Already in cache, be silent
+  SET(CHECK_FIND_QUIETLY TRUE)
+ENDIF (CHECK_INCLUDE_DIR)
+
 FIND_PATH(CHECK_INCLUDE_DIR NAMES check.h)
-MARK_AS_ADVANCED(CHECK_INCLUDE_DIR)
 
 # Look for the library.
 FIND_LIBRARY(CHECK_LIBRARY NAMES check)
-MARK_AS_ADVANCED(CHECK_LIBRARY)
 
-# Copy the results to the output variables.
-IF(CHECK_INCLUDE_DIR AND CHECK_LIBRARY)
-  SET(CHECK_FOUND 1)
-  SET(CHECK_LIBRARIES ${CHECK_LIBRARY})
-  SET(CHECK_INCLUDE_DIRS ${CHECK_INCLUDE_DIR})
-ELSE(CHECK_INCLUDE_DIR AND CHECK_LIBRARY)
-  SET(CHECK_FOUND 0)
-  SET(CHECK_LIBRARIES)
-  SET(CHECK_INCLUDE_DIRS)
-ENDIF(CHECK_INCLUDE_DIR AND CHECK_LIBRARY)
+# handle the QUIETLY and REQUIRED arguments and set CHECK_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(CHECK "Please install 'check' and 'check-devel' packages" CHECK_LIBRARY CHECK_INCLUDE_DIR)
 
-# Report the results.
-IF(NOT CHECK_FOUND)
-  SET(CHECK_DIR_MESSAGE
-    "check C unit testing library was not found. Install check and check-devel.")
-  IF(NOT Check_FIND_QUIETLY)
-    MESSAGE(STATUS "${CHECK_DIR_MESSAGE}")
-  ELSE(NOT Check_FIND_QUIETLY)
-    IF(Check_FIND_REQUIRED)
-      MESSAGE(FATAL_ERROR "${CHECK_DIR_MESSAGE}")
-    ENDIF(Check_FIND_REQUIRED)
-  ENDIF(NOT Check_FIND_QUIETLY)
-ELSE(NOT CHECK_FOUND)
-  MESSAGE(STATUS "check C unit testing library: ${CHECK_LIBRARIES}")
-ENDIF(NOT CHECK_FOUND)
+IF(CHECK_FOUND)
+  SET( CHECK_LIBRARIES ${CHECK_LIBRARY} )
+ELSE(CHECK_FOUND)
+  SET( CHECK_LIBRARIES )
+ENDIF(CHECK_FOUND)
+
+MARK_AS_ADVANCED(CHECK_INCLUDE_DIR)
+MARK_AS_ADVANCED(CHECK_LIBRARY)