Commit 303e832373c8c8612e23ab13fc53194604f14326

Use *Config.cmake instead of Find*.cmake
  
3838# check for required packages
3939if(STRIGI_VERSION_STRING)
4040 # libstreams is being compiled now too
41 set(LIBSTREAMS_INCLUDEDIR ../libstreams/include
42 ${CMAKE_CURRENT_BINARY_DIR}/../libstreams/include
43)
41 set(LIBSTREAMS_INCLUDE_DIRS
42 ../libstreams/include
43 ${CMAKE_CURRENT_BINARY_DIR}/../libstreams/include)
44 set(LIBSTREAMS_LIBRARIES streams)
4445else(STRIGI_VERSION_STRING)
4546 find_package(LibStreams REQUIRED)
4647endif(STRIGI_VERSION_STRING)
5050find_optional_dep(CLucene ENABLE_CLUCENE CLucene_FOUND "CLucene backend")
5151find_optional_dep(Exiv2 ENABLE_EXIV2 EXIV2_FOUND "indexing of EXIF/IPTC metadata")
5252include(ConfigureChecks.cmake)
53configure_file(LibStreamAnalyzer.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/LibStreamAnalyzerConfig.cmake @ONLY )
5354
5455##### building and testing #####
5556
5858 ${libstreamanalyzer_BINARY_DIR}/include/strigi/strigi_thread.h)
5959
6060# every directory needs the headers that will be installed
61include_directories(${LIBSTREAMS_INCLUDEDIR})
61include_directories(${LIBSTREAMS_INCLUDE_DIRS})
6262include_directories(${libstreamanalyzer_SOURCE_DIR}/include)
6363include_directories(${libstreamanalyzer_BINARY_DIR}/include)
6464link_directories(${LIBSTREAMS_LIBRARY_DIRS})
7878 ${libstreamanalyzer_BINARY_DIR}/include/strigi/strigi_thread.h
7979 DESTINATION include/strigi
8080)
81install(FILES ${CMAKE_CURRENT_BINARY_DIR}/LibStreamAnalyzerConfig.cmake
82 DESTINATION ${LIB_DESTINATION}/libstreamanalyzer)
8183# ontologies
8284file (GLOB STRIGI_ONTOLOGIES share/strigi/fieldproperties/*.rdfs)
8385install(FILES
  
1set(LIBSTREAMANALYZER_FOUND TRUE)
2set(LIBSTREAMANALYZER_VERSION @LIBSTREAMANALYZER_VERSION@)
3set(LIBSTREAMANALYZER_INCLUDE_DIRS @CMAKE_INSTALL_PREFIX@/include)
4set(LIBSTREAMANALYZER_LIBRARY_DIRS @LIB_DESTINATION@)
5set(LIBSTREAMANALYZER_LIBRARIES streamanalyzer)
  
1#
2# This module looks for libstreams
3# It will define the following values
4#
5# LIBSTREAMS_FOUND
6# LIBSTREAMS_INCLUDEDIR
7# LIBSTREAMS_LIBDIR
8# LIBSTREAMS_LIBS
9# LIBSTREAMS_VERSION
10
11if(WIN32)
12
13 file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _program_FILES_DIR)
14 find_path(LIBSTREAMS_INCLUDEDIR strigi/strigiconfig.h
15 ${_program_FILES_DIR}/libstreams/include
16 ${CMAKE_INSTALL_PREFIX}/include
17 ${CMAKE_INCLUDE_PATH}
18 )
19 set(LIBSTREAMS_LIBDIR ${_program_FILES_DIR}/dbus/lib)
20 find_library(LIBSTREAMS_LIBS NAMES streams
21 PATHS
22 ${LIBSTREAMS_LIBDIR}
23 ${CMAKE_INSTALL_PREFIX}/lib
24 ${CMAKE_LIBRARY_PATH}
25 )
26
27else(WIN32)
28
29 find_package(PkgConfig REQUIRED)
30 pkg_check_modules(LIBSTREAMS libstreams)
31
32endif(WIN32)
33
34if (LibStreams_FIND_REQUIRED)
35 if (NOT LIBSTREAMS_FOUND)
36 message(FATAL_ERROR "Could NOT find libstreams")
37 endif (NOT LIBSTREAMS_FOUND)
38endif (LibStreams_FIND_REQUIRED)
  
4040# generate the config file include/strigi/strigi-config.h and lib/config.h
4141include(ConfigureChecks.cmake)
4242configure_file(StrigiConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/StrigiConfig.cmake @ONLY )
43configure_file(LibStreamsConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/LibStreamsConfig.cmake @ONLY )
4344
4445
4546##### building and testing #####
6666)
6767install(FILES ${CMAKE_CURRENT_BINARY_DIR}/StrigiConfig.cmake
6868 DESTINATION ${LIB_DESTINATION}/strigi)
69install(FILES ${CMAKE_CURRENT_BINARY_DIR}/LibStreamsConfig.cmake
70 DESTINATION ${LIB_DESTINATION}/libstreams)
6971
7072# library
7173if(NOT WIN32)
  
1set(LIBSTREAMS_FOUND TRUE)
2set(LIBSTREAMS_VERSION @LIBSTREAMS_VERSION@)
3set(LIBSTREAMS_INCLUDE_DIRS @CMAKE_INSTALL_PREFIX@/include)
4set(LIBSTREAMS_LIBRARY_DIRS @LIB_DESTINATION@)
5set(LIBSTREAMS_LIBRARIES streams)
  
55
66cmake_minimum_required(VERSION 2.6)
77set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
8#include(MacroCheckGccVisibility)
9#include(MacroFindOptionalDep)
8include(MacroFindOptionalDep)
109enable_testing()
1110
1211
1313option(ENABLE_QT4 "enable Qt4 GUI" ON)
1414set(QT_MIN_VERSION "4.3.0")
1515
16# definition of LIB_DESTINATION which is the path where the lib is installed
17set (LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
18set (LIB_DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE STRING "Library directory name" FORCE)
1619
20
1721##### environment inspection #####
1822find_optional_dep(Qt4 ENABLE_QT4 QT4_FOUND "Qt4 GUI client")
1923if(QT4_FOUND)
2828# check for required packages
2929if(STRIGI_VERSION_STRING)
3030 # if STRIGI_VERSION_STRING is defined, we are compiling the meta-package
31 set(LIBSTREAMS_INCLUDES
31 set(LIBSTREAMS_INCLUDE_DIRS
3232 ../libstreams/include
3333 ${CMAKE_CURRENT_BINARY_DIR}/../libstreams/include)
34 set(LIBSTREAMANALYZER_INCLUDES
34 set(LIBSTREAMANALYZER_INCLUDE_DIRS
3535 ../libstreamanalyzer/include
3636 ${CMAKE_CURRENT_BINARY_DIR}/../libstreamanalyzer/include)
37 set(STRIGIDAEMON_INCLUDES
37 set(LIBSEARCHCLIENT_INCLUDE_DIRS
3838 ../strigidaemon/include)
39 set(LIBSTREAMS_LIBRARIES streams)
40 set(LIBSTREAMANALYZER_LIBRARIES streamanalyzer)
3941else(STRIGI_VERSION_STRING)
40 find_package(libstreams REQUIRED)
41 find_package(libstreamanalyzer REQUIRED)
42 find_package(LibStreams REQUIRED)
43 find_package(LibStreamAnalyzer REQUIRED)
44 find_package(LibSearchClient REQUIRED)
4245endif(STRIGI_VERSION_STRING)
4346
4447##### building and testing #####
4548
4649
4750# every directory needs the headers that will be installed
48include_directories(${LIBSTREAMS_INCLUDES})
49include_directories(${LIBSTREAMANALYZER_INCLUDES})
50include_directories(${STRIGIDAEMON_INCLUDES})
51include_directories(${LIBSTREAMS_INCLUDE_DIRS})
52include_directories(${LIBSTREAMANALYZER_INCLUDE_DIRS})
53include_directories(${LIBSEARCHCLIENT_INCLUDE_DIRS})
54link_directories(${LIBSTREAMANALYZER_LIBRARY_DIRS})
55link_directories(${LIBSEARCHCLIENT_LIBRARY_DIRS})
5156
5257add_subdirectory(lib)
5358add_subdirectory(bin)
  
1# FIND_OPTIONAL_DEP macro implements two typical optional dependency handling
2# approaches:
3#
4# Best-effort approach(FORCE_DEPS=OFF):
5# Link to all enabled optional dependencies if found. Turn off not found
6# ones, and keep compiling. This greatly benefits hand-compiling from source
7# if all suggested dependencies are turned on by default. Newly installed
8# software conveniently integrates with whatever environment it's compiled in.
9#
10# Strict dependencies approach(FORCE_DEPS=ON):
11# All enabled optional dependencies must be found, or compilation aborts.
12# This approach lets request and ensure specific functionality. The compilation
13# is deterministic in the sense that everything that's requested is provided
14# or the process fails. This is the preferred behaviour for automated building
15# by package managers/distro maintainers.
16#
17# Parameters:
18# _package: the package to load
19# _found: the name of *_FOUND variable which is set by find_package()
20# if ${_package} is found.
21# _enabled: option/variable name which along with FORCE_DEPS options
22# controls macro behaviour:
23# ${_enabled} FORCE_DEPS Behaviour
24# OFF any ${_package} is not loaded
25# ON ON Try loading ${_package}. If package is
26# not found, abort(fatal error).
27# ON OFF Try loading ${_package}. If package is
28# not found, continue.
29# _description: a short description of features provided by ${_package}.
30# Used to display human-readable diagnostic messages
31
32# macro name changed from FIND_OPTIONAL_PACKAGE to FIND_OPTIONAL_DEP due to
33# clash with a macro from KDE4
34
35# if ON, requested optional deps become required
36# if OFF, requested optional deps are linked to if found
37
38OPTION(FORCE_DEPS "Enforce strict dependencies" OFF)
39
40macro(FIND_OPTIONAL_DEP _package _enabled _found _description)
41
42 if(${_enabled})
43 if(FORCE_DEPS)
44 find_package(${_package} REQUIRED)
45 else(FORCE_DEPS)
46 find_package(${_package})
47 endif(FORCE_DEPS)
48 endif(${_enabled})
49
50 REPORT_OPTIONAL_PACKAGE_STATUS(${_package} ${_enabled} ${_found} ${_description})
51
52endmacro(FIND_OPTIONAL_DEP)
53
54
55macro(REPORT_OPTIONAL_PACKAGE_STATUS _package _enabled _found _description)
56
57 if(${_enabled})
58 if(${_found})
59 MESSAGE("** ${_package} is found. Support for ${_description} is enabled")
60 else(${_found})
61 MESSAGE("** ${_package} not found. Support for ${_description} is disabled")
62 endif(${_found})
63 else(${_enabled})
64 MESSAGE("** ${_package} is disabled. No support for ${_description}")
65 endif(${_enabled})
66
67endmacro(REPORT_OPTIONAL_PACKAGE_STATUS)
  
1616option(ENABLE_POLLING "enable monitoring the filesystem via polling" ON)
1717option(ENABLE_LOG4CXX "enable use of the logging framework Log4CXX" ON)
1818
19# definition of LIB_DESTINATION which is the path where the lib is installed
20set (LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
21set (LIB_DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE STRING "Library directory name" FORCE)
22
1923if(NOT MSVC AND NOT CMAKE_SYSTEM MATCHES "SunOS-5*.")
2024 add_definitions(-fPIC)
2125endif(NOT MSVC AND NOT CMAKE_SYSTEM MATCHES "SunOS-5*.")
2929# check for required packages
3030if(STRIGI_VERSION_STRING)
3131 # if STRIGI_VERSION_STRING is defined, we are compiling the meta-package
32 set(LIBSTREAMS_INCLUDES
32 set(LIBSTREAMS_INCLUDE_DIRS
3333 ../libstreams/include
3434 ${CMAKE_CURRENT_BINARY_DIR}/../libstreams/include)
35 set(LIBSTREAMANALYZER_INCLUDES
35 set(LIBSTREAMANALYZER_INCLUDE_DIRS
3636 ../libstreamanalyzer/include
3737 ${CMAKE_CURRENT_BINARY_DIR}/../libstreamanalyzer/include)
38 set(LIBSTREAMS_LIBRARIES streams)
39 set(LIBSTREAMANALYZER_LIBRARIES streamanalyzer)
3840else(STRIGI_VERSION_STRING)
39 find_package(libstreams REQUIRED)
40 find_package(libstreamanalyzer REQUIRED)
41 find_package(LibStreams REQUIRED)
42 find_package(LibStreamAnalyzer REQUIRED)
4143endif(STRIGI_VERSION_STRING)
4244find_package(Threads REQUIRED)
4345find_package(LibXml2 REQUIRED)
4949#find_optional_dep(CLucene ENABLE_CLUCENE CLucene_FOUND "CLucene backend")
5050#find_optional_dep(Exiv2 ENABLE_EXIV2 EXIV2_FOUND "indexing of EXIF/IPTC metadata")
5151include(ConfigureChecks.cmake)
52configure_file(LibSearchClient.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/LibSearchClientConfig.cmake @ONLY )
5253
5354##### building and testing #####
5455
5556configure_file(${strigidaemon_SOURCE_DIR}/strigi_thread.h.cmake
5657 ${strigidaemon_BINARY_DIR}/include/strigi/strigi_thread.h)
5758
58include_directories(${LIBSTREAMS_INCLUDES})
59include_directories(${LIBSTREAMANALYZER_INCLUDES})
59include_directories(${LIBSTREAMS_INCLUDE_DIRS})
60include_directories(${LIBSTREAMANALYZER_INCLUDE_DIRS})
6061include_directories(${strigidaemon_SOURCE_DIR}/include)
6162include_directories(${strigidaemon_BINARY_DIR}/include)
63link_directories(${LIBSTREAMS_LIBRARY_DIRS})
64link_directories(${LIBSTREAMANALYZER_LIBRARY_DIRS})
6265
6366add_subdirectory(lib)
6467add_subdirectory(bin)
7676 ${STRIGI_HEADERS}
7777 DESTINATION include/strigi
7878)
79install(FILES ${CMAKE_CURRENT_BINARY_DIR}/LibSearchClientConfig.cmake
80 DESTINATION ${LIB_DESTINATION}/libsearchclient)
7981file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp "")
8082add_executable(strigidaemon dummy.cpp)
8183target_link_libraries(strigidaemon libstrigidaemon)
8284install(TARGETS strigidaemon
8385 RUNTIME DESTINATION bin)
8486# library
85file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp "")
86add_library(searchclient SHARED ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp)
87set_target_properties(searchclient PROPERTIES
88 VERSION ${STRIGI_VERSION_STRING}
89 SOVERSION ${STRIGI_VERSION_MAJOR}
90 DEFINE_SYMBOL MAKE_SEARCHCLIENT_LIB
91)
92target_link_libraries(searchclient searchclientstatic)
93install(TARGETS searchclient
94 LIBRARY DESTINATION ${LIB_DESTINATION}
95 RUNTIME DESTINATION bin
96 ARCHIVE DESTINATION ${LIB_DESTINATION}
97)
  
1set(LIBSEARCHCLIENT_FOUND TRUE)
2set(LIBSEARCHCLIENT_VERSION @LIBSEARCHCLIENT_VERSION@)
3set(LIBSEARCHCLIENT_INCLUDE_DIRS @CMAKE_INSTALL_PREFIX@/include)
4set(LIBSEARCHCLIENT_LIBRARY_DIRS @LIB_DESTINATION@)
5set(LIBSEARCHCLIENT_LIBRARIES searchclient)
  
1add_library(searchclientstatic STATIC socketclient.cpp asyncsocket.cpp
1add_library(searchclient SHARED socketclient.cpp asyncsocket.cpp
22 asyncsocketclient.cpp)
3set_target_properties(searchclient PROPERTIES
4 VERSION ${STRIGI_VERSION_STRING}
5 SOVERSION ${STRIGI_VERSION_MAJOR}
6 DEFINE_SYMBOL MAKE_SEARCHCLIENT_LIB
7)
8target_link_libraries(searchclient ${LIBSTREAMANALYZER_LIBRARIES})
9install(TARGETS searchclient
10 LIBRARY DESTINATION ${LIB_DESTINATION}
11 RUNTIME DESTINATION bin
12 ARCHIVE DESTINATION ${LIB_DESTINATION}
13)
  
1717# check for required packages
1818if(STRIGI_VERSION_STRING)
1919 # if STRIGI_VERSION_STRING is defined, we are compiling the meta-package
20 set(LIBSTREAMS_INCLUDEDIR
20 set(LIBSTREAMS_INCLUDE_DIRS
2121 ../libstreams/include
2222 ${CMAKE_CURRENT_BINARY_DIR}/../libstreams/include)
23 set(LIBSTREAMANALYZER_INCLUDEDIR
23 set(LIBSTREAMANALYZER_INCLUDE_DIRS
2424 ../libstreamanalyzer/include
2525 ${CMAKE_CURRENT_BINARY_DIR}/../libstreamanalyzer/include)
26 set(LIBSTREAMS_LIBRARIES streams)
27 set(LIBSTREAMANALYZER_LIBRARIES streamanalyzer)
2628else(STRIGI_VERSION_STRING)
2729 find_package(LibStreams REQUIRED)
2830 find_package(LibStreamAnalyzer REQUIRED)
3232include(ConfigureChecks.cmake)
3333
3434##### building and testing #####
35include_directories(${LIBSTREAMS_INCLUDEDIR})
36include_directories(${LIBSTREAMANALYZER_INCLUDEDIR})
35include_directories(${LIBSTREAMS_INCLUDE_DIRS})
36include_directories(${LIBSTREAMANALYZER_INCLUDE_DIRS})
3737link_directories(${LIBSTREAMANALYZER_LIBRARY_DIRS})
3838
3939add_subdirectory(bin)
  
1#
2# This module looks for libstreamanalyzer
3# It will define the following values
4#
5# LIBSTREAMANALYZER_FOUND
6# LIBSTREAMANALYZER_INCLUDEDIR
7# LIBSTREAMANALYZER_LIBDIR
8# LIBSTREAMANALYZER_LIBS
9
10if(WIN32)
11
12 file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _program_FILES_DIR)
13 find_path(LIBSTREAMANALYZER_INCLUDEDIR strigi/strigiconfig.h
14 ${_program_FILES_DIR}/libstreamanalyzer/include
15 ${CMAKE_INSTALL_PREFIX}/include
16 ${CMAKE_INCLUDE_PATH}
17 )
18 set(LIBSTREAMANALYZER_LIBDIR ${_program_FILES_DIR}/dbus/lib)
19 find_library(LIBSTREAMANALYZER_LIBS NAMES streams
20 PATHS
21 ${LIBSTREAMANALYZER_LIBDIR}
22 ${CMAKE_INSTALL_PREFIX}/lib
23 ${CMAKE_LIBRARY_PATH}
24 )
25
26else(WIN32)
27
28 find_package(PkgConfig REQUIRED)
29 pkg_check_modules(LIBSTREAMANALYZER libstreamanalyzer)
30
31endif(WIN32)
32
33if (LibStreamAnalyzer_FIND_REQUIRED)
34 if (NOT LIBSTREAMANALYZER_FOUND)
35 message(FATAL_ERROR "Could NOT find libstreamanalyzer")
36 endif (NOT LIBSTREAMANALYZER_FOUND)
37endif (LibStreamAnalyzer_FIND_REQUIRED)
  
1#
2# This module looks for libstreams
3# It will define the following values
4#
5# LIBSTREAMS_FOUND
6# LIBSTREAMS_INCLUDEDIR
7# LIBSTREAMS_LIBDIR
8# LIBSTREAMS_LIBS
9# LIBSTREAMS_VERSION
10
11if(WIN32)
12
13 file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _program_FILES_DIR)
14 find_path(LIBSTREAMS_INCLUDEDIR strigi/strigiconfig.h
15 ${_program_FILES_DIR}/libstreams/include
16 ${CMAKE_INSTALL_PREFIX}/include
17 ${CMAKE_INCLUDE_PATH}
18 )
19 set(LIBSTREAMS_LIBDIR ${_program_FILES_DIR}/dbus/lib)
20 find_library(LIBSTREAMS_LIBS NAMES streams
21 PATHS
22 ${LIBSTREAMS_LIBDIR}
23 ${CMAKE_INSTALL_PREFIX}/lib
24 ${CMAKE_LIBRARY_PATH}
25 )
26
27else(WIN32)
28
29 find_package(PkgConfig REQUIRED)
30 pkg_check_modules(LIBSTREAMS libstreams)
31
32endif(WIN32)
33
34if (LibStreams_FIND_REQUIRED)
35 if (NOT LIBSTREAMS_FOUND)
36 message(FATAL_ERROR "Could NOT find libstreams")
37 endif (NOT LIBSTREAMS_FOUND)
38endif (LibStreams_FIND_REQUIRED)