Debian Codegraph @

podofo/cmake/modules/LibraryDebugAndRelease.cmake

raw
1 #
2 # This macro is used when we may have a debug and or release build of a library,
3 # and we want to produce a single easy to use library string that'll do the right
4 # thing. If both debug and release versions are available, we'll automatically use the
5 # debug version for debug builds and the release version for release builds.
6 #
7 # If only one build exists, we use that one irrespective of build type.
8 #
9 MACRO(SET_LIBRARY_FROM_DEBUG_AND_RELEASE _NAME)
10
11 IF(NOT DEFINED "${_NAME}_LIBRARY_RELEASE" OR NOT DEFINED "${_NAME}_LIBRARY_DEBUG")
12 MESSAGE(FATAL_ERROR "${_NAME}_LIBRARY_DEBUG OR ${_NAME}_LIBRARY_RELEASE undefined")
13 ENDIF(NOT DEFINED "${_NAME}_LIBRARY_RELEASE" OR NOT DEFINED "${_NAME}_LIBRARY_DEBUG")
14 IF(${_NAME}_LIBRARY_RELEASE AND ${_NAME}_LIBRARY_DEBUG)
15 SET(${_NAME}_LIBRARY "optimized;${${_NAME}_LIBRARY_RELEASE};debug;${${_NAME}_LIBRARY_DEBUG}")
16 ELSE(${_NAME}_LIBRARY_RELEASE AND ${_NAME}_LIBRARY_DEBUG)
17 IF(${_NAME}_LIBRARY_DEBUG)
18 MESSAGE("WARNING: ${_NAME} debug library will be used even for release builds")
19 SET(${_NAME}_LIBRARY ${${_NAME}_LIBRARY_DEBUG})
20 ELSE(${_NAME}_LIBRARY_DEBUG)
21 SET(${_NAME}_LIBRARY ${${_NAME}_LIBRARY_RELEASE})
22 ENDIF(${_NAME}_LIBRARY_DEBUG)
23 ENDIF(${_NAME}_LIBRARY_RELEASE AND ${_NAME}_LIBRARY_DEBUG)
24
25 ENDMACRO(SET_LIBRARY_FROM_DEBUG_AND_RELEASE)