]> git.mxchange.org Git - flightgear.git/commitdiff
Cmake: use debug version of plib when building in debug mode
authorFrederic Bouvier <fredfgfs01@free.fr>
Sat, 8 Jan 2011 14:17:49 +0000 (15:17 +0100)
committerFrederic Bouvier <fredfgfs01@free.fr>
Sat, 8 Jan 2011 14:17:49 +0000 (15:17 +0100)
CMakeModules/FindPLIB.cmake
CMakeModules/FindSimGear.cmake

index 09188948ff2e3af93e4f4e6590b5c93260a6fb7b..1fe81b200d5940f3e7f100f191775a8b1d4141f3 100644 (file)
@@ -34,6 +34,8 @@
 # OPENAL_LIBRARY to override this selection or set the CMake environment
 # CMAKE_INCLUDE_PATH to modify the search paths.
 
+include(SelectLibraryConfigurations)
+
 set(save_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK})
 set(CMAKE_FIND_FRAMEWORK ONLY)
 FIND_PATH(PLIB_INCLUDE_DIR ul.h
@@ -82,21 +84,40 @@ macro(find_static_component comp libs)
       set(compLib "plib${comp}")
     endif(MSVC)
     
-    string(TOUPPER "PLIB_${comp}_LIBRARY" compLibName)
-    
-    FIND_LIBRARY(${compLibName}
+    string(TOUPPER "PLIB_${comp}" compLibBase)
+    set( compLibName ${compLibBase}_LIBRARY )
+
+    FIND_LIBRARY(${compLibName}_DEBUG
+      NAMES ${compLib}_d
+      HINTS $ENV{SIMGEAR_DIR}
+      PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
+      PATHS
+      /usr/local
+      /usr
+      /opt
+    )
+    FIND_LIBRARY(${compLibName}_RELEASE
       NAMES ${compLib}
-      HINTS $ENV{PLIBDIR}
+      HINTS $ENV{SIMGEAR_DIR}
       PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
       PATHS
       /usr/local
       /usr
       /opt
     )
-    
-    set(componentLib ${${compLibName}})
-    if (NOT ${componentLib} STREQUAL "componentLib-NOTFOUND")
-        list(APPEND ${libs} ${componentLib})
+    select_library_configurations( ${compLibBase} )
+
+    set(componentLibRelease ${${compLibName}_RELEASE})
+    #message(STATUS "Simgear ${compLibName}_RELEASE ${componentLibRelease}")
+    set(componentLibDebug ${${compLibName}_DEBUG})
+    #message(STATUS "Simgear ${compLibName}_DEBUG ${componentLibDebug}")
+    if (NOT ${compLibName}_DEBUG)
+        if (NOT ${compLibName}_RELEASE)
+            #message(STATUS "found ${componentLib}")
+            list(APPEND ${libs} ${componentLibRelease})
+        endif()
+    else()
+        list(APPEND ${libs} optimized ${componentLibRelease} debug ${componentLibDebug})
     endif()
 endmacro()
 
index b17a4cb7fc35c98e12227ae6c6fa4b1cde7f2c77..8a494dde7166b3205e487a594c7004792ab0aba8 100644 (file)
@@ -33,7 +33,7 @@
 # People will have to manually change the cache values of 
 # SimGear_LIBRARIES to override this selection or set the CMake environment
 # CMAKE_INCLUDE_PATH to modify the search paths.
-    
+
 include(SelectLibraryConfigurations)
 
 FIND_PATH(SIMGEAR_INCLUDE_DIR simgear/math/SGMath.hxx
@@ -89,9 +89,9 @@ macro(find_sg_component comp libs)
     select_library_configurations( ${compLibBase} )
 
     set(componentLibRelease ${${compLibName}_RELEASE})
-    message(STATUS "Simgear ${compLibName}_RELEASE ${componentLibRelease}")
+    #message(STATUS "Simgear ${compLibName}_RELEASE ${componentLibRelease}")
     set(componentLibDebug ${${compLibName}_DEBUG})
-    message(STATUS "Simgear ${compLibName}_DEBUG ${componentLibDebug}")
+    #message(STATUS "Simgear ${compLibName}_DEBUG ${componentLibDebug}")
     if (NOT ${compLibName}_DEBUG)
         if (NOT ${compLibName}_RELEASE)
             #message(STATUS "found ${componentLib}")