aboutsummaryrefslogtreecommitdiff
path: root/modules/FindStrigi.cmake
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-08-03 01:40:00 +0000
committerAlexander Neundorf <neundorf@kde.org>2007-08-03 01:40:00 +0000
commitac081e93559fc128b739647478781a0159697f2f (patch)
tree803c765691a398d2ba2a7aff31855b3ebf53103a /modules/FindStrigi.cmake
parent2b9a0f1b3d7a91d93a63d4cf85c2d08e71d0906d (diff)
downloadextra-cmake-modules-ac081e93559fc128b739647478781a0159697f2f.tar.gz
extra-cmake-modules-ac081e93559fc128b739647478781a0159697f2f.tar.bz2
-add FindPackageHandleStandardArgs.cmake from cmake cvs, which adds a macro for handling the QUIETLY and REQUIRED arguments
for FIND_PACKAGE() and which sets the foo_FOUND variable if all additional variables are TRUE -use this new macro in FindStrigi. -put the successful query of pkgfconfig for the strigi version in the cache, so it doesn't have to do it again the next time -if pkgconfig doesn't find strigi at all, print a warning message but don't fail Alex svn path=/trunk/KDE/kdelibs/; revision=695818
Diffstat (limited to 'modules/FindStrigi.cmake')
-rw-r--r--modules/FindStrigi.cmake68
1 files changed, 28 insertions, 40 deletions
diff --git a/modules/FindStrigi.cmake b/modules/FindStrigi.cmake
index c6c2a883..5c24aa58 100644
--- a/modules/FindStrigi.cmake
+++ b/modules/FindStrigi.cmake
@@ -14,64 +14,52 @@ if (WIN32)
file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _program_FILES_DIR)
endif(WIN32)
-FIND_PATH(STRIGI_INCLUDE_DIR strigi/streamanalyzer.h
+find_path(STRIGI_INCLUDE_DIR strigi/streamanalyzer.h
PATHS
$ENV{STRIGI_HOME}/include
${CMAKE_INSTALL_PREFIX}/include
${_program_FILES_DIR}/strigi/include
)
-if (NOT WIN32)
- include(UsePkgConfig)
-
- EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS --atleast-version=${STRIGI_MIN_VERSION}
- libstreamanalyzer RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull )
-
- if(NOT _return_VALUE STREQUAL "0")
- message(STATUS "pkg-config query failed. did you set $PKG_CONFIG_PATH to the directory where strigi libstreamanalyzer.pc is installed?")
- message(FATAL_ERROR "Didn't find strigi >= ${STRIGI_MIN_VERSION}")
- else(NOT _return_VALUE STREQUAL "0")
- if(NOT Strigi_FIND_QUIETLY)
- message(STATUS "Found Strigi >= ${STRIGI_MIN_VERSION}")
- endif(NOT Strigi_FIND_QUIETLY)
- endif(NOT _return_VALUE STREQUAL "0")
-endif (NOT WIN32)
-
-FIND_LIBRARY(STRIGI_STREAMANALYZER_LIBRARY NAMES streamanalyzer
+find_library(STRIGI_STREAMANALYZER_LIBRARY NAMES streamanalyzer
PATHS
$ENV{STRIGI_HOME}/lib
${CMAKE_INSTALL_PREFIX}/lib
${_program_FILES_DIR}/strigi/lib
)
-FIND_LIBRARY(STRIGI_STREAMS_LIBRARY NAMES streams
+
+find_library(STRIGI_STREAMS_LIBRARY NAMES streams
PATHS
$ENV{STRIGI_HOME}/lib
${CMAKE_INSTALL_PREFIX}/lib
${_program_FILES_DIR}/strigi/lib
)
-IF(STRIGI_INCLUDE_DIR AND STRIGI_STREAMANALYZER_LIBRARY AND STRIGI_STREAMS_LIBRARY)
- SET(STRIGI_FOUND TRUE)
-ENDIF(STRIGI_INCLUDE_DIR AND STRIGI_STREAMANALYZER_LIBRARY AND STRIGI_STREAMS_LIBRARY)
+if (NOT WIN32 AND NOT HAVE_STRIGI_VERSION)
+ include(UsePkgConfig)
+ pkgconfig(libstreamanalyzer _dummyIncDir _dummyLinkDir _dummyLinkFlags _dummyCflags)
-IF(STRIGI_FOUND)
- SET(STRIGI_LIBRARIES ${STRIGI_STREAMANALYZER_LIBRARY} ${STRIGI_STREAMS_LIBRARY})
+ # if pkgconfig found strigi, check the version, otherwise print a warning
+ if(_dummyLinkFlags)
- IF(NOT Strigi_FIND_QUIETLY)
- MESSAGE(STATUS "Found Strigi: ${STRIGI_STREAMANALYZER_LIBRARY} ${STRIGI_STREAMS_LIBRARY} ")
- ENDIF(NOT Strigi_FIND_QUIETLY)
-ELSE(STRIGI_FOUND)
- IF(NOT Strigi_FIND_QUIETLY)
- IF(NOT STRIGI_STREAMANALYZER_LIBRARY)
- MESSAGE(STATUS "Couldn't find Strigi streamanalyzer library in $ENV{STRIGI_HOME}/lib, ${CMAKE_INSTALL_PREFIX}/lib, ${_program_FILES_DIR}/strigi/lib")
- ENDIF(NOT STRIGI_STREAMANALYZER_LIBRARY)
+ exec_program(${PKGCONFIG_EXECUTABLE} ARGS --atleast-version=${STRIGI_MIN_VERSION}
+ libstreamanalyzer RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull )
- IF(NOT STRIGI_STREAMS_LIBRARY)
- MESSAGE(STATUS "Couldn't find Strigi streams library in $ENV{STRIGI_HOME}/lib, ${CMAKE_INSTALL_PREFIX}/lib, ${_program_FILES_DIR}/strigi/lib")
- ENDIF(NOT STRIGI_STREAMS_LIBRARY)
- ENDIF(NOT Strigi_FIND_QUIETLY)
- IF(Strigi_FIND_REQUIRED)
- MESSAGE(FATAL_ERROR "Could not find Strigi")
- ENDIF(Strigi_FIND_REQUIRED)
-ENDIF(STRIGI_FOUND)
+ if(NOT _return_VALUE STREQUAL "0")
+ message(STATUS "pkg-config query failed. did you set $PKG_CONFIG_PATH to the directory where strigi libstreamanalyzer.pc is installed?")
+ message(FATAL_ERROR "Didn't find strigi >= ${STRIGI_MIN_VERSION}")
+ else(NOT _return_VALUE STREQUAL "0")
+ set(HAVE_STRIGI_VERSION TRUE CACHE BOOL "Have strigi version returned by pkgconfig")
+ if(NOT Strigi_FIND_QUIETLY)
+ message(STATUS "Found Strigi >= ${STRIGI_MIN_VERSION}")
+ endif(NOT Strigi_FIND_QUIETLY)
+ endif(NOT _return_VALUE STREQUAL "0")
+ else(_dummyLinkFlags)
+ message(STATUS "pkgconfig didn't find strigi, couldn't check strigi version")
+ endif(_dummyLinkFlags)
+endif (NOT WIN32 AND NOT HAVE_STRIGI_VERSION)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Strigi
+ "Couldn't find Strigi streams library in $ENV{STRIGI_HOME}/lib, ${CMAKE_INSTALL_PREFIX}/lib, ${_program_FILES_DIR}/strigi/lib"
+ STRIGI_STREAMS_LIBRARY STRIGI_STREAMANALYZER_LIBRARY STRIGI_INCLUDE_DIR)