diff options
author | Ralf Habacker <ralf.habacker@freenet.de> | 2007-06-08 07:44:16 +0000 |
---|---|---|
committer | Ralf Habacker <ralf.habacker@freenet.de> | 2007-06-08 07:44:16 +0000 |
commit | 7e7111d020a1d9859928b6e4c83efd81df6ad703 (patch) | |
tree | df85a44d57d1b00c9253ddc537ea409cd57144ff | |
parent | 04415ab3f093b2944985a525d65fe3a2555803cb (diff) | |
download | extra-cmake-modules-7e7111d020a1d9859928b6e4c83efd81df6ad703.tar.gz extra-cmake-modules-7e7111d020a1d9859928b6e4c83efd81df6ad703.tar.bz2 |
- splitted KDEWIN32 and GUNWIN32 module into KDEWIN and KDEWIN32, where KDEWIN sets include/library search path for all other modules and KDEWIN32 search for kdewin32 library in the found locations.
svn path=/trunk/KDE/kdelibs/; revision=672805
-rw-r--r-- | modules/FindGNUWIN32.cmake | 54 | ||||
-rw-r--r-- | modules/FindKDE4Internal.cmake | 8 | ||||
-rw-r--r-- | modules/FindKDEWIN.cmake | 56 | ||||
-rw-r--r-- | modules/FindKDEWIN32.cmake | 162 |
4 files changed, 130 insertions, 150 deletions
diff --git a/modules/FindGNUWIN32.cmake b/modules/FindGNUWIN32.cmake deleted file mode 100644 index d41af6f9..00000000 --- a/modules/FindGNUWIN32.cmake +++ /dev/null @@ -1,54 +0,0 @@ - -# Copyright (c) 2006, Peter Kuemmel, <syntheticpp@yahoo.com> -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - - -if (WIN32) - - IF (GNUWIN32_INCLUDE_DIR) - # Already in cache, be silent - SET(GNUWIN32_FIND_QUIETLY TRUE) - ENDIF (GNUWIN32_INCLUDE_DIR) - -# check if GNUWIN32_DIR is already set -# (e.g. by command line argument or the calling script) -if(NOT GNUWIN32_DIR) - # check for enviroment variable - file(TO_CMAKE_PATH "$ENV{GNUWIN32_DIR}" GNUWIN32_DIR) - if(NOT GNUWIN32_DIR) - # search in the default program install folder - file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _progFiles) - find_file(GNUWIN32_DIR_tmp win32libs gnuwin32 - PATHS - "${_progFiles}" - "C:/" "D:/" "E:/" "F:/" "G:/" - ) - set(GNUWIN32_DIR ${GNUWIN32_DIR_tmp}) - endif(NOT GNUWIN32_DIR) -endif(NOT GNUWIN32_DIR) - -if (GNUWIN32_DIR) - set(GNUWIN32_INCLUDE_DIR ${GNUWIN32_DIR}/include) - set(GNUWIN32_LIBRARY_DIR ${GNUWIN32_DIR}/lib) - set(GNUWIN32_BINARY_DIR ${GNUWIN32_DIR}/bin) - set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${GNUWIN32_INCLUDE_DIR}) - set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${GNUWIN32_LIBRARY_DIR}) - set(GNUWIN32_FOUND TRUE) -else (GNUWIN32_DIR) - set(GNUWIN32_FOUND) -endif (GNUWIN32_DIR) - -if (GNUWIN32_FOUND) - if (NOT GNUWIN32_FIND_QUIETLY) - message(STATUS "Found GNUWIN32: ${GNUWIN32_DIR}") - endif (NOT GNUWIN32_FIND_QUIETLY) -else (GNUWIN32_FOUND) - if (GNUWIN32_FIND_REQUIRED) - message(FATAL_ERROR "Could NOT find GNUWIN32") - endif (GNUWIN32_FIND_REQUIRED) -endif (GNUWIN32_FOUND) - -endif (WIN32) - diff --git a/modules/FindKDE4Internal.cmake b/modules/FindKDE4Internal.cmake index 74b86b8f..df3db208 100644 --- a/modules/FindKDE4Internal.cmake +++ b/modules/FindKDE4Internal.cmake @@ -533,11 +533,7 @@ if (WIN32) find_package(KDEWIN32 REQUIRED) - # is GnuWin32 required or does e.g. Visual Studio provide an own implementation? - #find_package(GNUWIN32 REQUIRED) - find_package(GNUWIN32) - - set( _KDE4_PLATFORM_INCLUDE_DIRS ${KDEWIN32_INCLUDES} ${GNUWIN32_INCLUDE_DIR}) + set( _KDE4_PLATFORM_INCLUDE_DIRS ${KDEWIN32_INCLUDES}) # if we are compiling kdelibs, add KDEWIN32_LIBRARIES explicitely, # otherwise they come from KDELibsDependencies.cmake, Alex @@ -777,7 +773,7 @@ endif (CMAKE_C_COMPILER MATCHES "icc") # we prefer to use a different postfix for debug libs only on Windows # does not work atm if (WIN32) - SET(CMAKE_DEBUG_POSTFIX "") + SET(CMAKE_DEBUG_POSTFIX "d") endif (WIN32) ########### end of platform specific stuff ########################## diff --git a/modules/FindKDEWIN.cmake b/modules/FindKDEWIN.cmake new file mode 100644 index 00000000..3e40fd37 --- /dev/null +++ b/modules/FindKDEWIN.cmake @@ -0,0 +1,56 @@ +# - Try to find the KDEWIN library +# +# used environment vars +# KDEWIN_DIR - kdewin root dir +# +# this will define +# KDEWIN_FOUND - system has KDEWIN +# KDEWIN_DIR - the KDEWIN root installation dir +# +# Copyright (c) 2007, Ralf Habacker, <ralf.habacker@freenet.de> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +if (WIN32) + IF (NOT KDEWIN_DIR) + # check for enviroment variable + file(TO_CMAKE_PATH "$ENV{KDEWIN_DIR}" KDEWIN_DIR) + if(NOT KDEWIN_DIR) + file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _progFiles) + if (MINGW) + set (DIR "kdewin-mingw") + else (MINGW) + set (DIR "kdewin-msvc") + endif (MINGW) + + # search in the default program install folder + find_file(KDEWIN_DIR_tmp ${DIR} kdewin kdewin32 gnuwin32 + PATHS + "${_progFiles}" + ) + set (KDEWIN_DIR ${KDEWIN_DIR_tmp}) + endif (NOT KDEWIN_DIR) + if (KDEWIN_DIR) + message(STATUS "Found windows supplementary package location: ${KDEWIN_DIR}") + endif (KDEWIN_DIR) + endif (NOT KDEWIN_DIR) + + # this must be set every time + if (KDEWIN_DIR) + # add include path and library to all targets, this is required because + # cmake's 2.4.6 FindZLib.cmake does not use CMAKE_REQUIRED... vars + set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${KDEWIN_DIR}/include) + set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${KDEWIN_DIR}/lib) + + set (KDEWIN_FOUND 1) + else(KDEWIN_DIR) + message(STATUS "Could not find the location of the windows supplementary packages which is \n" + "\t\tenvironment variable KDEWIN_DIR\n" + "\t\t<ProgramFiles>/${DIR}\n" + "\t\t<ProgramFiles>/kdewin\n" + "\t\t<ProgramFiles>/kdewin32\n" + "\t\t<ProgramFiles>/gnuwin32\n") + endif(KDEWIN_DIR) + +endif (WIN32) diff --git a/modules/FindKDEWIN32.cmake b/modules/FindKDEWIN32.cmake index ac284cd4..17eab61d 100644 --- a/modules/FindKDEWIN32.cmake +++ b/modules/FindKDEWIN32.cmake @@ -7,119 +7,101 @@ # KDEWIN32_LIBRARIES - The libraries needed to use KDEWIN32 # # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> +# Copyright (c) 2007, Ralf Habacker, <ralf.habacker@freenet.de> # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (WIN32) - if (NOT KDEWIN32_DIR) - if(NOT QT4_FOUND) - find_package(Qt4 REQUIRED) - endif(NOT QT4_FOUND) - - # check for enviroment variable first - file(TO_CMAKE_PATH "$ENV{KDEWIN32_DIR}" KDEWIN32_DIR) - - # then check default installation dir - if (NOT KDEWIN32_DIR) - file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _progFiles) - find_file(KDEWIN32_DIR_tmp kdewin32 - PATHS - "${_progFiles}" - ) - set (KDEWIN32_DIR ${KDEWIN32_DIR_tmp}) - endif (NOT KDEWIN32_DIR) - endif (NOT KDEWIN32_DIR) - - find_path(KDEWIN32_INCLUDE_DIR winposix_export.h - ${KDEWIN32_DIR}/include - ${CMAKE_INSTALL_PREFIX}/include - ) + if(NOT KDEWIN_FOUND) + find_package(KDEWIN REQUIRED) + endif(NOT KDEWIN_FOUND) - # at first find the kdewin32 library, this has to be compiled and installed before kdelibs/ - # search for kdewin32 in the default install directory for applications (default of (n)make install) - - find_library(KDEWIN32_LIBRARY_DEBUG NAMES kdewin32d - PATHS - ${KDEWIN32_DIR}/lib - ${CMAKE_INSTALL_PREFIX}/lib - NO_SYSTEM_ENVIRONMENT_PATH - ) + find_path(KDEWIN32_INCLUDE_DIR winposix_export.h + ${CMAKE_INCLUDE_PATH} + ${CMAKE_INSTALL_PREFIX}/include + ) + + # search for kdewin32 in the default install directory for applications (default of (n)make install) - find_library(KDEWIN32_LIBRARY_RELEASE NAMES kdewin32 - PATHS - ${KDEWIN32_DIR}/lib - ${CMAKE_INSTALL_PREFIX}/lib - NO_SYSTEM_ENVIRONMENT_PATH - ) - - # msvc makes a difference between debug and release - if(MSVC) find_library(KDEWIN32_LIBRARY_DEBUG NAMES kdewin32d PATHS - ${KDEWIN32_DIR}/lib + ${CMAKE_LIBRARY_PATH} ${CMAKE_INSTALL_PREFIX}/lib NO_SYSTEM_ENVIRONMENT_PATH ) - if(MSVC_IDE) - # the ide needs the debug and release version - if( NOT KDEWIN32_LIBRARY_DEBUG OR NOT KDEWIN32_LIBRARY_RELEASE) - message(FATAL_ERROR "\nCould NOT find the debug AND release version of the KDEWIN32 library.\nYou need to have both to use MSVC projects.\nPlease build and install both kdelibs/win/ libraries first.\n") - endif( NOT KDEWIN32_LIBRARY_DEBUG OR NOT KDEWIN32_LIBRARY_RELEASE) - SET(KDEWIN32_LIBRARY optimized ${KDEWIN32_LIBRARY_RELEASE} debug ${KDEWIN32_LIBRARY_DEBUG}) - else(MSVC_IDE) - string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER) - if(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) - set(KDEWIN32_LIBRARY ${KDEWIN32_LIBRARY_DEBUG}) - else(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) - set(KDEWIN32_LIBRARY ${KDEWIN32_LIBRARY_RELEASE}) - endif(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) - endif(MSVC_IDE) - else(MSVC) - if(KDEWIN32_LIBRARY_RELEASE) - set(KDEWIN32_LIBRARY ${KDEWIN32_LIBRARY_RELEASE}) - else(KDEWIN32_LIBRARY_RELEASE) - set(KDEWIN32_LIBRARY ${KDEWIN32_LIBRARY_DEBUG}) - endif(KDEWIN32_LIBRARY_RELEASE) - endif(MSVC) - # kdelibs/win/ has to be built before the rest of kdelibs/ - # eventually it will be moved out from kdelibs/ - if (KDEWIN32_LIBRARY AND KDEWIN32_INCLUDE_DIR) - set(KDEWIN32_FOUND TRUE) - # add needed system libs - set(KDEWIN32_LIBRARIES ${KDEWIN32_LIBRARY} user32 shell32 ws2_32) - - if (MINGW) - #mingw compiler - set(KDEWIN32_INCLUDES ${KDEWIN32_INCLUDE_DIR} ${KDEWIN32_INCLUDE_DIR}/mingw ${QT_INCLUDES}) - else (MINGW) - # msvc compiler - # add the MS SDK include directory if available - file(TO_CMAKE_PATH "$ENV{MSSDK}" MSSDK_DIR) - set(KDEWIN32_INCLUDES ${KDEWIN32_INCLUDE_DIR} ${KDEWIN32_INCLUDE_DIR}/msvc ${QT_INCLUDES} ${MSSDK_DIR}) - endif (MINGW) + find_library(KDEWIN32_LIBRARY_RELEASE NAMES kdewin32 + PATHS + ${CMAKE_LIBRARY_PATH} + ${CMAKE_INSTALL_PREFIX}/lib + NO_SYSTEM_ENVIRONMENT_PATH + ) + + # msvc makes a difference between debug and release + if(MSVC) + find_library(KDEWIN32_LIBRARY_DEBUG NAMES kdewin32d + PATHS + ${CMAKE_LIBRARY_PATH + ${CMAKE_INSTALL_PREFIX}/lib + NO_SYSTEM_ENVIRONMENT_PATH + ) + if(MSVC_IDE) + # the ide needs the debug and release version + if( NOT KDEWIN32_LIBRARY_DEBUG OR NOT KDEWIN32_LIBRARY_RELEASE) + message(FATAL_ERROR "\nCould NOT find the debug AND release version of the KDEWIN32 library.\nYou need to have both to use MSVC projects.\nPlease build and install both kdelibs/win/ libraries first.\n") + endif( NOT KDEWIN32_LIBRARY_DEBUG OR NOT KDEWIN32_LIBRARY_RELEASE) + SET(KDEWIN32_LIBRARY optimized ${KDEWIN32_LIBRARY_RELEASE} debug ${KDEWIN32_LIBRARY_DEBUG}) + else(MSVC_IDE) + string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER) + if(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) + set(KDEWIN32_LIBRARY ${KDEWIN32_LIBRARY_DEBUG}) + else(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) + set(KDEWIN32_LIBRARY ${KDEWIN32_LIBRARY_RELEASE}) + endif(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) + endif(MSVC_IDE) + else(MSVC) + if(KDEWIN32_LIBRARY_RELEASE) + set(KDEWIN32_LIBRARY ${KDEWIN32_LIBRARY_RELEASE}) + else(KDEWIN32_LIBRARY_RELEASE) + set(KDEWIN32_LIBRARY ${KDEWIN32_LIBRARY_DEBUG}) + endif(KDEWIN32_LIBRARY_RELEASE) + endif(MSVC) + + # kdelibs/win/ has to be built before the rest of kdelibs/ + # eventually it will be moved out from kdelibs/ + if (KDEWIN32_LIBRARY AND KDEWIN32_INCLUDE_DIR) + set(KDEWIN32_FOUND TRUE) + # add needed system libs + set(KDEWIN32_LIBRARIES ${KDEWIN32_LIBRARY} user32 shell32 ws2_32) + + if (MINGW) + #mingw compiler + set(KDEWIN32_INCLUDES ${KDEWIN32_INCLUDE_DIR} ${KDEWIN32_INCLUDE_DIR}/mingw ${QT_INCLUDES}) + else (MINGW) + # msvc compiler + # add the MS SDK include directory if available + file(TO_CMAKE_PATH "$ENV{MSSDK}" MSSDK_DIR) + set(KDEWIN32_INCLUDES ${KDEWIN32_INCLUDE_DIR} ${KDEWIN32_INCLUDE_DIR}/msvc ${QT_INCLUDES} ${MSSDK_DIR}) + endif (MINGW) + + endif (KDEWIN32_LIBRARY AND KDEWIN32_INCLUDE_DIR) + # required for configure + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${KDEWIN32_INCLUDES}) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${KDEWIN32_LIBRARIES}) - endif (KDEWIN32_LIBRARY AND KDEWIN32_INCLUDE_DIR) + endif (NOT KDEWIN32_DIR) if (KDEWIN32_FOUND) if (NOT KDEWIN32_FIND_QUIETLY) - message(STATUS "Found KDEWIN32: ${KDEWIN32_LIBRARY}") + message(STATUS "Found kdewin32 library: ${KDEWIN32_LIBRARY}") endif (NOT KDEWIN32_FIND_QUIETLY) + else (KDEWIN32_FOUND) if (KDEWIN32_FIND_REQUIRED) message(FATAL_ERROR "Could NOT find KDEWIN32 library\nPlease install it first") endif (KDEWIN32_FIND_REQUIRED) endif (KDEWIN32_FOUND) - - # add include path and library to all targets, this is required because - # cmake's 2.4.6 FindZLib.cmake does not use CMAKE_REQUIRED... vars - set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${KDEWIN32_INCLUDES}) - set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${KDEWIN32_DIR}/lib) - - set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${KDEWIN32_INCLUDES}) - set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${KDEWIN32_LIBRARIES}) - endif (WIN32) |