ENH: use the new FILE(TO_CMAKE_PATH ...) command instead of regexps

BUG: append the kde 4 cmake module path instead of prepending it

Alex
This commit is contained in:
Alexander Neundorf 2006-05-11 18:27:13 -04:00
parent 221a169cb9
commit 97fcff2445
1 changed files with 13 additions and 22 deletions

View File

@ -10,18 +10,15 @@
#
# Author: Alexander Neundorf <neundorf@kde.org>
FILE(TO_CMAKE_PATH "$ENV{KDEDIRS}" _KDEDIRS)
# First try to find kde-config
FIND_PROGRAM(KDE4_KDECONFIG_EXECUTABLE NAMES kde-config
PATHS
${CMAKE_INSTALL_PREFIX}/bin
$ENV{KDEDIR}/bin
${_KDEDIRS}
/opt/kde4/bin
/opt/kde
/bin
/usr/bin
/usr/local/bin
NO_SYSTEM_PATH
NO_CMAKE_SYSTEM_PATH
NO_DEFAULT_PATH
)
@ -33,14 +30,7 @@ IF (KDE4_KDECONFIG_EXECUTABLE)
# then ask kde-config for the kde data dirs
EXEC_PROGRAM(${KDE4_KDECONFIG_EXECUTABLE} ARGS --path data OUTPUT_VARIABLE _data_DIR )
IF(WIN32)
# cmake can't handle paths with '\' correct :-(
STRING(REGEX REPLACE "\\\\" "/" _data_DIR "${_data_DIR}")
ELSE(WIN32)
# replace the ":" with ";" so that it becomes a valid cmake list
STRING(REGEX REPLACE ":" ";" _data_DIR "${_data_DIR}")
ENDIF(WIN32)
FILE(TO_CMAKE_PATH "${_data_DIR}" _data_DIR)
# then check the data dirs for FindKDE4Internal.cmake
FIND_PATH(KDE4_DATA_DIR cmake/modules/FindKDE4Internal.cmake ${_data_DIR})
@ -48,7 +38,7 @@ IF (KDE4_KDECONFIG_EXECUTABLE)
# if it has been found...
IF (KDE4_DATA_DIR)
SET(CMAKE_MODULE_PATH ${KDE4_DATA_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${KDE4_DATA_DIR}/cmake/modules)
IF (KDE4_FIND_QUIETLY)
SET(_quiet QUIET)
@ -61,13 +51,14 @@ IF (KDE4_KDECONFIG_EXECUTABLE)
# use FindKDE4Internal.cmake to do the rest
FIND_PACKAGE(KDE4Internal ${_req} ${_quiet})
ELSE (KDE4_DATA_DIR)
MESSAGE(FATAL_ERROR "ERROR: cmake/modules/FindKDE4Internal.cmake not found in ${_data_DIR}")
IF (KDE4_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "ERROR: cmake/modules/FindKDE4Internal.cmake not found in ${_data_DIR}")
ENDIF (KDE4_FIND_REQUIRED)
ENDIF (KDE4_DATA_DIR)
ELSE (KDE4_KDECONFIG_EXECUTABLE)
IF (KDE4_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "ERROR: Could not find KDE4 kde-config")
ENDIF (KDE4_FIND_REQUIRED)
ENDIF (KDE4_KDECONFIG_EXECUTABLE)
IF (KDE4_FIND_REQUIRED AND NOT KDE4_FOUND)
MESSAGE(FATAL_ERROR "ERROR: Could not find KDE4")
ENDIF (KDE4_FIND_REQUIRED AND NOT KDE4_FOUND)