1
0
Fork 0

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

This commit is contained in:
Frederic Bouvier 2011-01-08 15:02:30 +01:00
parent 8cab5f9e60
commit 311925ecb4

View file

@ -34,6 +34,8 @@
# SimGear_LIBRARIES to override this selection or set the CMake environment # SimGear_LIBRARIES 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)
FIND_PATH(SIMGEAR_INCLUDE_DIR simgear/math/SGMath.hxx FIND_PATH(SIMGEAR_INCLUDE_DIR simgear/math/SGMath.hxx
HINTS $ENV{SIMGEAR_DIR} HINTS $ENV{SIMGEAR_DIR}
PATH_SUFFIXES include PATH_SUFFIXES include
@ -63,10 +65,11 @@ FIND_LIBRARY(SIMGEAR_LIBRARIES
macro(find_sg_component comp libs) macro(find_sg_component comp libs)
set(compLib "sg${comp}") set(compLib "sg${comp}")
string(TOUPPER "SIMGEAR_${comp}_LIBRARY" compLibName) string(TOUPPER "SIMGEAR_${comp}" compLibBase)
set( compLibName ${compLibBase}_LIBRARY )
FIND_LIBRARY(${compLibName} FIND_LIBRARY(${compLibName}_DEBUG
NAMES ${compLib} NAMES ${compLib}${CMAKE_DEBUG_POSTFIX}
HINTS $ENV{SIMGEAR_DIR} 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
@ -74,11 +77,28 @@ macro(find_sg_component comp libs)
/usr /usr
/opt /opt
) )
FIND_LIBRARY(${compLibName}_RELEASE
NAMES ${compLib}${CMAKE_RELEASE_POSTFIX}
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}")
set(componentLibDebug ${${compLibName}_DEBUG})
message(STATUS "Simgear ${compLibName}_DEBUG ${componentLibDebug}")
if (NOT ${compLibName}_DEBUG)
if (NOT ${compLibName}_RELEASE)
#message(STATUS "found ${componentLib}") #message(STATUS "found ${componentLib}")
list(APPEND ${libs} ${componentLib}) list(APPEND ${libs} ${componentLibRelease})
endif()
else()
list(APPEND ${libs} optimized ${componentLibRelease} debug ${componentLibDebug})
endif() endif()
endmacro() endmacro()