diff options
Diffstat (limited to 'Modules/FindKDE3.cmake')
-rw-r--r-- | Modules/FindKDE3.cmake | 228 |
1 files changed, 114 insertions, 114 deletions
diff --git a/Modules/FindKDE3.cmake b/Modules/FindKDE3.cmake index 65a559fa78..a8d30a890e 100644 --- a/Modules/FindKDE3.cmake +++ b/Modules/FindKDE3.cmake @@ -3,8 +3,8 @@ # This module defines the following variables: # KDE3_DEFINITIONS - compiler definitions required for compiling KDE software # KDE3_INCLUDE_DIR - the KDE include directory -# KDE3_INCLUDE_DIRS - the KDE and the Qt include directory, for use with INCLUDE_DIRECTORIES() -# KDE3_LIB_DIR - the directory where the KDE libraries are installed, for use with LINK_DIRECTORIES() +# KDE3_INCLUDE_DIRS - the KDE and the Qt include directory, for use with include_directories() +# KDE3_LIB_DIR - the directory where the KDE libraries are installed, for use with link_directories() # QT_AND_KDECORE_LIBS - this contains both the Qt and the kdecore library # KDE3_DCOPIDL_EXECUTABLE - the dcopidl executable # KDE3_DCOPIDL2CPP_EXECUTABLE - the dcopidl2cpp executable @@ -23,7 +23,7 @@ # Call this if you want to have automatic moc file handling. # This means if you include "foo.moc" in the source file foo.cpp # a moc file for the header foo.h will be created automatically. -# You can set the property SKIP_AUTOMAKE using SET_SOURCE_FILES_PROPERTIES() +# You can set the property SKIP_AUTOMAKE using set_source_files_properties() # to exclude some files in the list from being processed. # # KDE3_ADD_MOC_FILES(SRCS_VAR file1 ... fileN ) @@ -46,7 +46,7 @@ # This will create and install a simple libtool file for the given target. # # KDE3_ADD_EXECUTABLE(name file1 ... fileN ) -# Currently identical to ADD_EXECUTABLE(), may provide some advanced features in the future. +# Currently identical to add_executable(), may provide some advanced features in the future. # # KDE3_ADD_KPART(name [WITH_PREFIX] file1 ... fileN ) # Create a KDE plugin (KPart, kioslave, etc.) from the given source files. @@ -77,37 +77,37 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -IF(NOT UNIX AND KDE3_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Compiling KDE3 applications and libraries under Windows is not supported") -ENDIF(NOT UNIX AND KDE3_FIND_REQUIRED) +if(NOT UNIX AND KDE3_FIND_REQUIRED) + message(FATAL_ERROR "Compiling KDE3 applications and libraries under Windows is not supported") +endif(NOT UNIX AND KDE3_FIND_REQUIRED) # If Qt4 has already been found, fail. -IF(QT4_FOUND) - IF(KDE3_FIND_REQUIRED) - MESSAGE( FATAL_ERROR "KDE3/Qt3 and Qt4 cannot be used together in one project.") - ELSE(KDE3_FIND_REQUIRED) - IF(NOT KDE3_FIND_QUIETLY) - MESSAGE( STATUS "KDE3/Qt3 and Qt4 cannot be used together in one project.") - ENDIF(NOT KDE3_FIND_QUIETLY) - RETURN() - ENDIF(KDE3_FIND_REQUIRED) -ENDIF(QT4_FOUND) +if(QT4_FOUND) + if(KDE3_FIND_REQUIRED) + message( FATAL_ERROR "KDE3/Qt3 and Qt4 cannot be used together in one project.") + else(KDE3_FIND_REQUIRED) + if(NOT KDE3_FIND_QUIETLY) + message( STATUS "KDE3/Qt3 and Qt4 cannot be used together in one project.") + endif(NOT KDE3_FIND_QUIETLY) + return() + endif(KDE3_FIND_REQUIRED) +endif(QT4_FOUND) -SET(QT_MT_REQUIRED TRUE) -#SET(QT_MIN_VERSION "3.0.0") +set(QT_MT_REQUIRED TRUE) +#set(QT_MIN_VERSION "3.0.0") #this line includes FindQt.cmake, which searches the Qt library and headers -IF(KDE3_FIND_REQUIRED) - SET(_REQ_STRING_KDE3 "REQUIRED") -ENDIF(KDE3_FIND_REQUIRED) +if(KDE3_FIND_REQUIRED) + set(_REQ_STRING_KDE3 "REQUIRED") +endif(KDE3_FIND_REQUIRED) -FIND_PACKAGE(Qt3 ${_REQ_STRING_KDE3}) -FIND_PACKAGE(X11 ${_REQ_STRING_KDE3}) +find_package(Qt3 ${_REQ_STRING_KDE3}) +find_package(X11 ${_REQ_STRING_KDE3}) #now try to find some kde stuff -FIND_PROGRAM(KDECONFIG_EXECUTABLE NAMES kde-config +find_program(KDECONFIG_EXECUTABLE NAMES kde-config HINTS $ENV{KDEDIR}/bin PATHS @@ -115,25 +115,25 @@ FIND_PROGRAM(KDECONFIG_EXECUTABLE NAMES kde-config /opt/kde/bin ) -SET(KDE3PREFIX) -IF(KDECONFIG_EXECUTABLE) - EXECUTE_PROCESS(COMMAND ${KDECONFIG_EXECUTABLE} --version +set(KDE3PREFIX) +if(KDECONFIG_EXECUTABLE) + execute_process(COMMAND ${KDECONFIG_EXECUTABLE} --version OUTPUT_VARIABLE kde_config_version ) - STRING(REGEX MATCH "KDE: .\\." kde_version "${kde_config_version}") - IF ("${kde_version}" MATCHES "KDE: 3\\.") - EXECUTE_PROCESS(COMMAND ${KDECONFIG_EXECUTABLE} --prefix + string(REGEX MATCH "KDE: .\\." kde_version "${kde_config_version}") + if ("${kde_version}" MATCHES "KDE: 3\\.") + execute_process(COMMAND ${KDECONFIG_EXECUTABLE} --prefix OUTPUT_VARIABLE kdedir ) - STRING(REGEX REPLACE "\n" "" KDE3PREFIX "${kdedir}") + string(REGEX REPLACE "\n" "" KDE3PREFIX "${kdedir}") - ENDIF ("${kde_version}" MATCHES "KDE: 3\\.") -ENDIF(KDECONFIG_EXECUTABLE) + endif ("${kde_version}" MATCHES "KDE: 3\\.") +endif(KDECONFIG_EXECUTABLE) # at first the KDE include directory # kpassdlg.h comes from kdeui and doesn't exist in KDE4 anymore -FIND_PATH(KDE3_INCLUDE_DIR kpassdlg.h +find_path(KDE3_INCLUDE_DIR kpassdlg.h HINTS $ENV{KDEDIR}/include ${KDE3PREFIX}/include @@ -145,7 +145,7 @@ FIND_PATH(KDE3_INCLUDE_DIR kpassdlg.h ) #now the KDE library directory -FIND_LIBRARY(KDE3_KDECORE_LIBRARY NAMES kdecore +find_library(KDE3_KDECORE_LIBRARY NAMES kdecore HINTS $ENV{KDEDIR}/lib ${KDE3PREFIX}/lib @@ -154,20 +154,20 @@ FIND_LIBRARY(KDE3_KDECORE_LIBRARY NAMES kdecore /opt/kde/lib ) -SET(QT_AND_KDECORE_LIBS ${QT_LIBRARIES} ${KDE3_KDECORE_LIBRARY}) +set(QT_AND_KDECORE_LIBS ${QT_LIBRARIES} ${KDE3_KDECORE_LIBRARY}) -GET_FILENAME_COMPONENT(KDE3_LIB_DIR ${KDE3_KDECORE_LIBRARY} PATH ) +get_filename_component(KDE3_LIB_DIR ${KDE3_KDECORE_LIBRARY} PATH ) -IF(NOT KDE3_LIBTOOL_DIR) - IF(KDE3_KDECORE_LIBRARY MATCHES lib64) - SET(KDE3_LIBTOOL_DIR /lib64/kde3) - ELSE(KDE3_KDECORE_LIBRARY MATCHES lib64) - SET(KDE3_LIBTOOL_DIR /lib/kde3) - ENDIF(KDE3_KDECORE_LIBRARY MATCHES lib64) -ENDIF(NOT KDE3_LIBTOOL_DIR) +if(NOT KDE3_LIBTOOL_DIR) + if(KDE3_KDECORE_LIBRARY MATCHES lib64) + set(KDE3_LIBTOOL_DIR /lib64/kde3) + else(KDE3_KDECORE_LIBRARY MATCHES lib64) + set(KDE3_LIBTOOL_DIR /lib/kde3) + endif(KDE3_KDECORE_LIBRARY MATCHES lib64) +endif(NOT KDE3_LIBTOOL_DIR) #now search for the dcop utilities -FIND_PROGRAM(KDE3_DCOPIDL_EXECUTABLE NAMES dcopidl +find_program(KDE3_DCOPIDL_EXECUTABLE NAMES dcopidl HINTS $ENV{KDEDIR}/bin ${KDE3PREFIX}/bin @@ -176,7 +176,7 @@ FIND_PROGRAM(KDE3_DCOPIDL_EXECUTABLE NAMES dcopidl /opt/kde/bin ) -FIND_PROGRAM(KDE3_DCOPIDL2CPP_EXECUTABLE NAMES dcopidl2cpp +find_program(KDE3_DCOPIDL2CPP_EXECUTABLE NAMES dcopidl2cpp HINTS $ENV{KDEDIR}/bin ${KDE3PREFIX}/bin @@ -185,7 +185,7 @@ FIND_PROGRAM(KDE3_DCOPIDL2CPP_EXECUTABLE NAMES dcopidl2cpp /opt/kde/bin ) -FIND_PROGRAM(KDE3_KCFGC_EXECUTABLE NAMES kconfig_compiler +find_program(KDE3_KCFGC_EXECUTABLE NAMES kconfig_compiler HINTS $ENV{KDEDIR}/bin ${KDE3PREFIX}/bin @@ -196,104 +196,104 @@ FIND_PROGRAM(KDE3_KCFGC_EXECUTABLE NAMES kconfig_compiler #SET KDE3_FOUND -IF (KDE3_INCLUDE_DIR AND KDE3_LIB_DIR AND KDE3_DCOPIDL_EXECUTABLE AND KDE3_DCOPIDL2CPP_EXECUTABLE AND KDE3_KCFGC_EXECUTABLE) - SET(KDE3_FOUND TRUE) -ELSE (KDE3_INCLUDE_DIR AND KDE3_LIB_DIR AND KDE3_DCOPIDL_EXECUTABLE AND KDE3_DCOPIDL2CPP_EXECUTABLE AND KDE3_KCFGC_EXECUTABLE) - SET(KDE3_FOUND FALSE) -ENDIF (KDE3_INCLUDE_DIR AND KDE3_LIB_DIR AND KDE3_DCOPIDL_EXECUTABLE AND KDE3_DCOPIDL2CPP_EXECUTABLE AND KDE3_KCFGC_EXECUTABLE) +if (KDE3_INCLUDE_DIR AND KDE3_LIB_DIR AND KDE3_DCOPIDL_EXECUTABLE AND KDE3_DCOPIDL2CPP_EXECUTABLE AND KDE3_KCFGC_EXECUTABLE) + set(KDE3_FOUND TRUE) +else (KDE3_INCLUDE_DIR AND KDE3_LIB_DIR AND KDE3_DCOPIDL_EXECUTABLE AND KDE3_DCOPIDL2CPP_EXECUTABLE AND KDE3_KCFGC_EXECUTABLE) + set(KDE3_FOUND FALSE) +endif (KDE3_INCLUDE_DIR AND KDE3_LIB_DIR AND KDE3_DCOPIDL_EXECUTABLE AND KDE3_DCOPIDL2CPP_EXECUTABLE AND KDE3_KCFGC_EXECUTABLE) # add some KDE specific stuff -SET(KDE3_DEFINITIONS -DQT_CLEAN_NAMESPACE -D_GNU_SOURCE) +set(KDE3_DEFINITIONS -DQT_CLEAN_NAMESPACE -D_GNU_SOURCE) # set compiler flags only if KDE3 has actually been found -IF(KDE3_FOUND) - SET(_KDE3_USE_FLAGS FALSE) - IF(CMAKE_COMPILER_IS_GNUCXX) - SET(_KDE3_USE_FLAGS TRUE) # use flags for gnu compiler - EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} --version +if(KDE3_FOUND) + set(_KDE3_USE_FLAGS FALSE) + if(CMAKE_COMPILER_IS_GNUCXX) + set(_KDE3_USE_FLAGS TRUE) # use flags for gnu compiler + execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE out) # gnu gcc 2.96 does not work with flags # I guess 2.95 also doesn't then - IF("${out}" MATCHES "2.9[56]") - SET(_KDE3_USE_FLAGS FALSE) - ENDIF("${out}" MATCHES "2.9[56]") - ENDIF(CMAKE_COMPILER_IS_GNUCXX) + if("${out}" MATCHES "2.9[56]") + set(_KDE3_USE_FLAGS FALSE) + endif("${out}" MATCHES "2.9[56]") + endif(CMAKE_COMPILER_IS_GNUCXX) #only on linux, but NOT e.g. on FreeBSD: - IF(CMAKE_SYSTEM_NAME MATCHES "Linux" AND _KDE3_USE_FLAGS) - SET (KDE3_DEFINITIONS ${KDE3_DEFINITIONS} -D_XOPEN_SOURCE=500 -D_BSD_SOURCE) - SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common") - SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fno-exceptions -fno-check-new -fno-common") - ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux" AND _KDE3_USE_FLAGS) + if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND _KDE3_USE_FLAGS) + set (KDE3_DEFINITIONS ${KDE3_DEFINITIONS} -D_XOPEN_SOURCE=500 -D_BSD_SOURCE) + set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common") + set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fno-exceptions -fno-check-new -fno-common") + endif(CMAKE_SYSTEM_NAME MATCHES "Linux" AND _KDE3_USE_FLAGS) # works on FreeBSD, NOT tested on NetBSD and OpenBSD - IF (CMAKE_SYSTEM_NAME MATCHES BSD AND _KDE3_USE_FLAGS) - SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common") - SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common") - ENDIF (CMAKE_SYSTEM_NAME MATCHES BSD AND _KDE3_USE_FLAGS) + if (CMAKE_SYSTEM_NAME MATCHES BSD AND _KDE3_USE_FLAGS) + set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common") + set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common") + endif (CMAKE_SYSTEM_NAME MATCHES BSD AND _KDE3_USE_FLAGS) # if no special buildtype is selected, add -O2 as default optimization - IF (NOT CMAKE_BUILD_TYPE AND _KDE3_USE_FLAGS) - SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2") - SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2") - ENDIF (NOT CMAKE_BUILD_TYPE AND _KDE3_USE_FLAGS) + if (NOT CMAKE_BUILD_TYPE AND _KDE3_USE_FLAGS) + set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2") + set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2") + endif (NOT CMAKE_BUILD_TYPE AND _KDE3_USE_FLAGS) -#SET(CMAKE_SHARED_LINKER_FLAGS "-avoid-version -module -Wl,--no-undefined -Wl,--allow-shlib-undefined") -#SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -avoid-version -Wl,--no-undefined -lc") -#SET(CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings -avoid-version -Wl,--no-undefined -lc") -ENDIF(KDE3_FOUND) +#set(CMAKE_SHARED_LINKER_FLAGS "-avoid-version -module -Wl,--no-undefined -Wl,--allow-shlib-undefined") +#set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -avoid-version -Wl,--no-undefined -lc") +#set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings -avoid-version -Wl,--no-undefined -lc") +endif(KDE3_FOUND) # KDE3Macros.cmake contains all the KDE specific macros -INCLUDE(KDE3Macros) +include(KDE3Macros) -MACRO (KDE3_PRINT_RESULTS) - IF(KDE3_INCLUDE_DIR) - MESSAGE(STATUS "Found KDE3 include dir: ${KDE3_INCLUDE_DIR}") - ELSE(KDE3_INCLUDE_DIR) - MESSAGE(STATUS "Didn't find KDE3 headers") - ENDIF(KDE3_INCLUDE_DIR) +macro (KDE3_PRINT_RESULTS) + if(KDE3_INCLUDE_DIR) + message(STATUS "Found KDE3 include dir: ${KDE3_INCLUDE_DIR}") + else(KDE3_INCLUDE_DIR) + message(STATUS "Didn't find KDE3 headers") + endif(KDE3_INCLUDE_DIR) - IF(KDE3_LIB_DIR) - MESSAGE(STATUS "Found KDE3 library dir: ${KDE3_LIB_DIR}") - ELSE(KDE3_LIB_DIR) - MESSAGE(STATUS "Didn't find KDE3 core library") - ENDIF(KDE3_LIB_DIR) + if(KDE3_LIB_DIR) + message(STATUS "Found KDE3 library dir: ${KDE3_LIB_DIR}") + else(KDE3_LIB_DIR) + message(STATUS "Didn't find KDE3 core library") + endif(KDE3_LIB_DIR) - IF(KDE3_DCOPIDL_EXECUTABLE) - MESSAGE(STATUS "Found KDE3 dcopidl preprocessor: ${KDE3_DCOPIDL_EXECUTABLE}") - ELSE(KDE3_DCOPIDL_EXECUTABLE) - MESSAGE(STATUS "Didn't find the KDE3 dcopidl preprocessor") - ENDIF(KDE3_DCOPIDL_EXECUTABLE) + if(KDE3_DCOPIDL_EXECUTABLE) + message(STATUS "Found KDE3 dcopidl preprocessor: ${KDE3_DCOPIDL_EXECUTABLE}") + else(KDE3_DCOPIDL_EXECUTABLE) + message(STATUS "Didn't find the KDE3 dcopidl preprocessor") + endif(KDE3_DCOPIDL_EXECUTABLE) - IF(KDE3_DCOPIDL2CPP_EXECUTABLE) - MESSAGE(STATUS "Found KDE3 dcopidl2cpp preprocessor: ${KDE3_DCOPIDL2CPP_EXECUTABLE}") - ELSE(KDE3_DCOPIDL2CPP_EXECUTABLE) - MESSAGE(STATUS "Didn't find the KDE3 dcopidl2cpp preprocessor") - ENDIF(KDE3_DCOPIDL2CPP_EXECUTABLE) + if(KDE3_DCOPIDL2CPP_EXECUTABLE) + message(STATUS "Found KDE3 dcopidl2cpp preprocessor: ${KDE3_DCOPIDL2CPP_EXECUTABLE}") + else(KDE3_DCOPIDL2CPP_EXECUTABLE) + message(STATUS "Didn't find the KDE3 dcopidl2cpp preprocessor") + endif(KDE3_DCOPIDL2CPP_EXECUTABLE) - IF(KDE3_KCFGC_EXECUTABLE) - MESSAGE(STATUS "Found KDE3 kconfig_compiler preprocessor: ${KDE3_KCFGC_EXECUTABLE}") - ELSE(KDE3_KCFGC_EXECUTABLE) - MESSAGE(STATUS "Didn't find the KDE3 kconfig_compiler preprocessor") - ENDIF(KDE3_KCFGC_EXECUTABLE) + if(KDE3_KCFGC_EXECUTABLE) + message(STATUS "Found KDE3 kconfig_compiler preprocessor: ${KDE3_KCFGC_EXECUTABLE}") + else(KDE3_KCFGC_EXECUTABLE) + message(STATUS "Didn't find the KDE3 kconfig_compiler preprocessor") + endif(KDE3_KCFGC_EXECUTABLE) -ENDMACRO (KDE3_PRINT_RESULTS) +endmacro (KDE3_PRINT_RESULTS) -IF (KDE3_FIND_REQUIRED AND NOT KDE3_FOUND) +if (KDE3_FIND_REQUIRED AND NOT KDE3_FOUND) #bail out if something wasn't found KDE3_PRINT_RESULTS() - MESSAGE(FATAL_ERROR "Could NOT find everything required for compiling KDE 3 programs") + message(FATAL_ERROR "Could NOT find everything required for compiling KDE 3 programs") -ENDIF (KDE3_FIND_REQUIRED AND NOT KDE3_FOUND) +endif (KDE3_FIND_REQUIRED AND NOT KDE3_FOUND) -IF (NOT KDE3_FIND_QUIETLY) +if (NOT KDE3_FIND_QUIETLY) KDE3_PRINT_RESULTS() -ENDIF (NOT KDE3_FIND_QUIETLY) +endif (NOT KDE3_FIND_QUIETLY) #add the found Qt and KDE include directories to the current include path -SET(KDE3_INCLUDE_DIRS ${QT_INCLUDE_DIR} ${KDE3_INCLUDE_DIR}) +set(KDE3_INCLUDE_DIRS ${QT_INCLUDE_DIR} ${KDE3_INCLUDE_DIR}) |