Minor fixes to the build scripts for MSVC debug builds, and added debug library suppo...
authorChris Moeller <kode54@gmail.com>
Thu, 19 Jan 2012 22:18:31 +0000 (14:18 -0800)
committerManuel Nickschas <sputnick@quassel-irc.org>
Mon, 19 Mar 2012 21:09:57 +0000 (22:09 +0100)
CMakeLists.txt
cmake/modules/FindPhonon.cmake
cmake/modules/FindQCA2.cmake

index 967715e..63d5f5f 100644 (file)
@@ -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)
index 28969c7..e4355d0 100644 (file)
@@ -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)
index a7d2c62..04a5091 100644 (file)
@@ -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}