[CMake] Proper use of CMAKE_<CONFIG>_POSTFIX

Michael Jackson mike.jackson at bluequartz.net
Wed Mar 4 11:28:23 EST 2009


What are the pros and cons of using CMAKE_<CONFIG>_POSTFIX such as  
CMAKE_DEBUG_POSTFIX and CMAKE_RELEASE_POSTFIX versus using the  
"set_target_properties" method to change the name of the generated  
executable or library?

Besides the fact that "This property is ignored on the Mac for  
Frameworks and App Bundles."?

I have a whole bunch of code that uses the following style:

IF (BUILD_SHARED_LIBS)
   IF (WIN32 AND NOT MINGW)
       SET(LIB_RELEASE_NAME "tiffdll")
       SET(LIB_DEBUG_NAME "tiffdll_D")
   ELSE (WIN32 AND NOT MINGW)
       SET(LIB_RELEASE_NAME "tiff")
       SET(LIB_DEBUG_NAME "tiff_debug")
   ENDIF(WIN32 AND NOT MINGW)
ELSE (BUILD_SHARED_LIBS)
   IF (WIN32 AND NOT MINGW)
       SET(LIB_RELEASE_NAME "libtiff")
       SET(LIB_DEBUG_NAME "libtiff_D")
   ELSE (WIN32 AND NOT MINGW)
       SET(LIB_RELEASE_NAME "tiff")
       SET(LIB_DEBUG_NAME "tiff_debug")
   ENDIF(WIN32 AND NOT MINGW)
ENDIF (BUILD_SHARED_LIBS)

ADD_LIBRARY(tiff ${LIB_TYPE} ${TIFF_SRCS} ${TIFF_HEADERS})
TARGET_LINK_LIBRARIES( tiff ${SUPPORT_LIBS} )

SET_TARGET_PROPERTIES( tiff
   PROPERTIES
   DEBUG_OUTPUT_NAME ${LIB_DEBUG_NAME}
   RELEASE_OUTPUT_NAME ${LIB_RELEASE_NAME}
)


Thanks

_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio



More information about the CMake mailing list