From 82e3e9ecf0dab3fe687fe1b690333308aaafbe50 Mon Sep 17 00:00:00 2001 From: Chris Moeller Date: Thu, 19 Jan 2012 14:18:31 -0800 Subject: [PATCH] Minor fixes to the build scripts for MSVC debug builds, and added debug library support to the Phonon and QCA2 scripts. --- CMakeLists.txt | 4 ++-- cmake/modules/FindPhonon.cmake | 23 +++++++++++++++++++++-- cmake/modules/FindQCA2.cmake | 26 +++++++++++++++++++++++--- 3 files changed, 46 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 967715e8..63d5f5fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -385,8 +385,8 @@ if(WIN32) link_libraries(imm32 winmm dbghelp Secur32) # missing by default :/ if(MSVC) set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBUGINFO "/debug /INCREMENTAL:YES /NODEFAULTLIB:libcmt /DEFAULTLIB:msvcrt") - set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBUGINFO}") - set(CMAKE_EXE_LINKER_FLAGS_DEBUGFULL "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBUGINFO}") + set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:YES /NODEFAULTLIB:libcmt") + set(CMAKE_EXE_LINKER_FLAGS_DEBUGFULL "${CMAKE_EXE_LINKER_FLAGS_DEBUG}") link_libraries(Version dwmapi shlwapi) endif(MSVC) if(HAVE_SSL AND STATIC) diff --git a/cmake/modules/FindPhonon.cmake b/cmake/modules/FindPhonon.cmake index 28969c71..e4355d0e 100644 --- a/cmake/modules/FindPhonon.cmake +++ b/cmake/modules/FindPhonon.cmake @@ -31,9 +31,28 @@ else(PHONON_FOUND) endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) # As discussed on kde-buildsystem: first look at CMAKE_PREFIX_PATH, then at the suggested PATHS (kde4 install dir) - find_library(PHONON_LIBRARY NAMES phonon phonon4 PATHS ${KDE4_LIB_INSTALL_DIR} ${QT_LIBRARY_DIR} NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) + find_library(PHONON_LIBRARY_RELEASE NAMES phonon phonon4 PATHS ${KDE4_LIB_INSTALL_DIR} ${QT_LIBRARY_DIR} NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) + find_library(PHONON_LIBRARY_DEBUG NAMES phonond phonond4 PATHS ${KD4_LIB_INSTALL} ${QT_LIBRARY_DIR} NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) # then at the default system locations (CMAKE_SYSTEM_PREFIX_PATH, i.e. /usr etc.) - find_library(PHONON_LIBRARY NAMES phonon phonon4) + find_library(PHONON_LIBRARY_RELEASE NAMES phonon phonon4) + find_library(PHONON_LIBRARY_DEBUG NAMES phonond phonond4) + + # if the release- as well as the debug-version of the library have been found: + IF (PHONON_LIBRARY_DEBUG AND PHONON_LIBRARY_RELEASE) + # if the generator supports configuration types then set + # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value + IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + SET(PHONON_LIBRARY optimized ${PHONON_LIBRARY_RELEASE} debug ${PHONON_LIBRARY_DEBUG}) + ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + # if there are no configuration types and CMAKE_BUILD_TYPE has no value + # then just use the release libraries + SET(PHONON_LIBRARY ${PHONON_LIBRARY_RELEASE} ) + ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + ELSE(PHONON_LIBRARY_DEBUG AND PHONON_LIBRARY_RELEASE) + IF (PHONON_LIBRARY_RELEASE) + SET(PHONON_LIBRARY ${PHONON_LIBRARY_RELEASE}) + ENDIF (PHONON_LIBRARY_RELEASE) + ENDIF (PHONON_LIBRARY_DEBUG AND PHONON_LIBRARY_RELEASE) find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h PATHS ${KDE4_INCLUDE_INSTALL_DIR} ${QT_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR} ${QT_LIBRARY_DIR} NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h) diff --git a/cmake/modules/FindQCA2.cmake b/cmake/modules/FindQCA2.cmake index a7d2c62d..04a50913 100644 --- a/cmake/modules/FindQCA2.cmake +++ b/cmake/modules/FindQCA2.cmake @@ -30,11 +30,31 @@ else (QCA2_INCLUDE_DIR AND QCA2_LIBRARIES) set(QCA2_DEFINITIONS ${PC_QCA2_CFLAGS_OTHER}) endif (NOT WIN32) - find_library_with_debug(QCA2_LIBRARIES - WIN32_DEBUG_POSTFIX d - NAMES qca + find_library(QCA2_LIBRARIES_DEBUG + NAMES qcad qcad2 HINTS ${PC_QCA2_LIBDIR} ${PC_QCA2_LIBRARY_DIRS} ) + find_library(QCA2_LIBRARIES_RELEASE + NAMES qca qca2 + HINTS ${PC_QCA2_LIBDIR} ${PC_QCA2_LIBRARY_DIRS} + ) + # if the release- as well as the debug-version of the library have been found: + IF (QCA2_LIBRARIES_DEBUG AND QCA2_LIBRARIES_RELEASE) + # if the generator supports configuration types then set + # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value + IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + SET(QCA2_LIBRARIES optimized ${QCA2_LIBRARIES_RELEASE} debug ${QCA2_LIBRARIES_DEBUG}) + ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + # if there are no configuration types and CMAKE_BUILD_TYPE has no value + # then just use the release libraries + SET(QCA2_LIBRARIES ${QCA2_LIBRARIES_RELEASE} ) + ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + ELSE (QCA2_LIBRARIES_DEBUG AND QCA2_LIBRARIES_RELEASE) + IF (QCA2_LIBRARIES_RELEASE) + SET(QCA2_LIBRARIES ${QCA2_LIBRARIES_RELEASE}) + ENDIF (QCA2_LIBRARIES_RELEASE) + ENDIF (QCA2_LIBRARIES_DEBUG AND QCA2_LIBRARIES_RELEASE) + find_path(QCA2_INCLUDE_DIR qca.h HINTS ${PC_QCA2_INCLUDEDIR} ${PC_QCA2_INCLUDE_DIRS} -- 2.20.1