aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-11-24 23:52:04 +0000
committerAlexander Neundorf <neundorf@kde.org>2007-11-24 23:52:04 +0000
commita85c3dc5371b8d45400b894b957e9eb4e6ff98cf (patch)
tree01d6f343cf47c5d736f78152be4e217f6d7952a5
parent594cb7ec267e0c5e2cb9b956094b19a7f2675bc6 (diff)
downloadextra-cmake-modules-a85c3dc5371b8d45400b894b957e9eb4e6ff98cf.tar.gz
extra-cmake-modules-a85c3dc5371b8d45400b894b957e9eb4e6ff98cf.tar.bz2
It is really a bad idea to search for stuff _only_ using NO_DEFAULT_PATH.
In the case that what you are looking for is somewhere else then cmake has no way to find it. For custom install locations cmake provides the environment variables CMAKE_LIBRARY_PATH and FIND_INCLUDE_PATH. So if you have your own set of install locations, set these two environment variables accordingly. cmake cvs additionally offers CMAKE_FIND_PREFIX_PATH, which is used by all FIND_PATH/FILE/LIBRARY/PROGRAM() calls with the appropriate subdir appended. I.e. if you install everything to ~/mystuff/, do export CMAKE_FIND_PREFIX_PATH=$HOME/mystuff, cmake will append the include/, lib/ and bin/ subdirectories automatically. Adding CMAKE_INSTALL_DIR/<suffix> is not necessary, this is done by default in FindKDE4Internal.cmake (and in cmake > 2.4.7). So now at first the FIND_XXX() calls are used with NO_DEFAULT_PATH, so no change here for UNIX, and after that the FIND_XXX() calls are used without NO_DEFAULT_PATH for the case that the first one didn't succeed (so no change for Windows). This has the nice effect that the cmake-provided means to specify custom search locations work again. Alex CCMAIL: ch.ehrlicher@gmx.de CCMAIL: kretz@kde.org svn path=/trunk/KDE/kdelibs/; revision=741164
-rw-r--r--modules/FindStrigi.cmake36
1 files changed, 24 insertions, 12 deletions
diff --git a/modules/FindStrigi.cmake b/modules/FindStrigi.cmake
index f28f733a..6ad6ec74 100644
--- a/modules/FindStrigi.cmake
+++ b/modules/FindStrigi.cmake
@@ -6,6 +6,10 @@
# STRIGI_STREAMANALYZER_LIBRARY - Link these to use Strigi streamanalyzer
# STRIGI_STREAMS_LIBRARY - Link these to use Strigi streams
+# at first search only in the specified directories (NO_DEFAULT_PATH)
+# only if it wasn't found there, the second call to FIND_PATH/LIBRARY()
+# will actually do something, Alex
+
include(FindLibraryWithDebug)
if(NOT STRIGI_MIN_VERSION)
@@ -15,9 +19,6 @@ endif(NOT STRIGI_MIN_VERSION)
if (WIN32)
file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _program_FILES_DIR)
string(REPLACE "\\" "/" _program_FILES_DIR "${_program_FILES_DIR}")
- set(STRIGI_NO_DEF_PATH "")
-else(WIN32)
- set(STRIGI_NO_DEF_PATH NO_DEFAULT_PATH)
endif(WIN32)
string(REPLACE "\\" "/" strigi_home "$ENV{STRIGI_HOME}")
@@ -25,41 +26,52 @@ string(REPLACE "\\" "/" strigi_home "$ENV{STRIGI_HOME}")
find_path(STRIGI_INCLUDE_DIR strigi/streamanalyzer.h
PATHS
${strigi_home}/include
- ${CMAKE_INSTALL_PREFIX}/include
${_program_FILES_DIR}/strigi/include
- ${STRIGI_NO_DEF_PATH}
+ NO_DEFAULT_PATH
)
+find_path(STRIGI_INCLUDE_DIR strigi/streamanalyzer.h)
+
find_library_with_debug(STRIGI_STREAMANALYZER_LIBRARY
WIN32_DEBUG_POSTFIX d
NAMES streamanalyzer
PATHS
${strigi_home}/lib
- ${CMAKE_INSTALL_PREFIX}/lib
${_program_FILES_DIR}/strigi/lib
- ${STRIGI_NO_DEF_PATH}
+ NO_DEFAULT_PATH
)
+find_library_with_debug(STRIGI_STREAMANALYZER_LIBRARY
+ WIN32_DEBUG_POSTFIX d
+ NAMES streamanalyzer )
+
+
find_library_with_debug(STRIGI_STREAMS_LIBRARY
WIN32_DEBUG_POSTFIX d
NAMES streams
PATHS
${strigi_home}/lib
- ${CMAKE_INSTALL_PREFIX}/lib
${_program_FILES_DIR}/strigi/lib
- ${STRIGI_NO_DEF_PATH}
+ NO_DEFAULT_PATH
)
+find_library_with_debug(STRIGI_STREAMS_LIBRARY
+ WIN32_DEBUG_POSTFIX d
+ NAMES streams )
+
find_library_with_debug(STRIGI_STRIGIQTDBUSCLIENT_LIBRARY
WIN32_DEBUG_POSTFIX d
NAMES strigiqtdbusclient
PATHS
${strigi_home}/lib
- ${CMAKE_INSTALL_PREFIX}/lib
${_program_FILES_DIR}/strigi/lib
- ${STRIGI_NO_DEF_PATH}
+ NO_DEFAULT_PATH
)
+find_library_with_debug(STRIGI_STRIGIQTDBUSCLIENT_LIBRARY
+ WIN32_DEBUG_POSTFIX d
+ NAMES strigiqtdbusclient )
+
if (NOT WIN32 AND NOT HAVE_STRIGI_VERSION)
include(UsePkgConfig)
@@ -103,6 +115,6 @@ endif (NOT WIN32 AND NOT HAVE_STRIGI_VERSION)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Strigi
- "Couldn't find Strigi streams library in $STRIGI_HOME/lib, ${CMAKE_INSTALL_PREFIX}/lib, ${_program_FILES_DIR}/strigi/lib"
+ "Couldn't find Strigi streams library. Set the environment variable STRIGI_HOME (or CMAKE_FIND_PREFIX_PATH if using CMake >=2.5) to the strigi install dir."
STRIGI_STREAMS_LIBRARY STRIGI_STREAMANALYZER_LIBRARY STRIGI_INCLUDE_DIR)