diff options
-rw-r--r-- | modules/FindKDEWIN32.cmake | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/modules/FindKDEWIN32.cmake b/modules/FindKDEWIN32.cmake index c9017602..bec51304 100644 --- a/modules/FindKDEWIN32.cmake +++ b/modules/FindKDEWIN32.cmake @@ -22,22 +22,36 @@ FIND_PATH(KDEWIN32_INCLUDE_DIR winposix_export.h # 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) -set(_KDEWIN32_SEARCHNAMES kdewin32 kdewin32d) -#overwrite when using msvc, which cannot mix debug/release libraries -if(MSVC) - if(CMAKE_BUILD_TYPE MATCHES Debug) - set(_KDEWIN32_SEARCHNAMES kdewin32d ) - else(CMAKE_BUILD_TYPE MATCHES Debug) - set(_KDEWIN32_SEARCHNAMES kdewin32 ) - endif(CMAKE_BUILD_TYPE MATCHES Debug) -endif(MSVC) - -FIND_LIBRARY(KDEWIN32_LIBRARY NAMES ${_KDEWIN32_SEARCHNAMES} +FIND_LIBRARY(KDEWIN32_LIBRARY_RELEASE NAMES kdewin32 PATHS ${_program_FILES_DIR}/kdewin32/lib ) +# msvc makes a difference between debug and release +if(MSVC) + FIND_LIBRARY(KDEWIN32_LIBRARY_DEBUG NAMES kdewin32d + PATHS + ${_program_FILES_DIR}/kdewin32/lib + ) + if(MSVC_IDE) + # the ide needs the debug and release version + if( NOT KDEWIN32_LIBRARY_DEBUG OR NOT KDEWIN32_LIBRARY_RELEASE) + message(FATAL_ERROR "Could 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:\nUse a project generator or the cmake parameter\n-DCMAKE_BUILD_TYPE=release for building the release version nmake makefiles.") + 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) + set(KDEWIN32_LIBRARY ${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) |