1
0
Fork 0

Cmake: use debug version of plib when building in debug mode

This commit is contained in:
Frederic Bouvier 2011-01-08 15:17:49 +01:00
parent 311925ecb4
commit 39ecaf0ca8
2 changed files with 33 additions and 12 deletions

View file

@ -34,6 +34,8 @@
# OPENAL_LIBRARY to override this selection or set the CMake environment # OPENAL_LIBRARY to override this selection or set the CMake environment
# CMAKE_INCLUDE_PATH to modify the search paths. # CMAKE_INCLUDE_PATH to modify the search paths.
include(SelectLibraryConfigurations)
set(save_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK}) set(save_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK})
set(CMAKE_FIND_FRAMEWORK ONLY) set(CMAKE_FIND_FRAMEWORK ONLY)
FIND_PATH(PLIB_INCLUDE_DIR ul.h FIND_PATH(PLIB_INCLUDE_DIR ul.h
@ -82,21 +84,40 @@ macro(find_static_component comp libs)
set(compLib "plib${comp}") set(compLib "plib${comp}")
endif(MSVC) endif(MSVC)
string(TOUPPER "PLIB_${comp}_LIBRARY" compLibName) string(TOUPPER "PLIB_${comp}" compLibBase)
set( compLibName ${compLibBase}_LIBRARY )
FIND_LIBRARY(${compLibName} FIND_LIBRARY(${compLibName}_DEBUG
NAMES ${compLib} NAMES ${compLib}_d
HINTS $ENV{PLIBDIR} HINTS $ENV{SIMGEAR_DIR}
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64 PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
PATHS PATHS
/usr/local /usr/local
/usr /usr
/opt /opt
) )
FIND_LIBRARY(${compLibName}_RELEASE
NAMES ${compLib}
HINTS $ENV{SIMGEAR_DIR}
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
PATHS
/usr/local
/usr
/opt
)
select_library_configurations( ${compLibBase} )
set(componentLib ${${compLibName}}) set(componentLibRelease ${${compLibName}_RELEASE})
if (NOT ${componentLib} STREQUAL "componentLib-NOTFOUND") #message(STATUS "Simgear ${compLibName}_RELEASE ${componentLibRelease}")
list(APPEND ${libs} ${componentLib}) 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() endif()
endmacro() endmacro()

View file

@ -89,9 +89,9 @@ macro(find_sg_component comp libs)
select_library_configurations( ${compLibBase} ) select_library_configurations( ${compLibBase} )
set(componentLibRelease ${${compLibName}_RELEASE}) set(componentLibRelease ${${compLibName}_RELEASE})
message(STATUS "Simgear ${compLibName}_RELEASE ${componentLibRelease}") #message(STATUS "Simgear ${compLibName}_RELEASE ${componentLibRelease}")
set(componentLibDebug ${${compLibName}_DEBUG}) set(componentLibDebug ${${compLibName}_DEBUG})
message(STATUS "Simgear ${compLibName}_DEBUG ${componentLibDebug}") #message(STATUS "Simgear ${compLibName}_DEBUG ${componentLibDebug}")
if (NOT ${compLibName}_DEBUG) if (NOT ${compLibName}_DEBUG)
if (NOT ${compLibName}_RELEASE) if (NOT ${compLibName}_RELEASE)
#message(STATUS "found ${componentLib}") #message(STATUS "found ${componentLib}")