This is my first time using CMake and I'm trying to build QJSon, a JSON parser for Qt 4.x. What I want basically is to build different output library names depending on the build configuration. I'm using ${CMAKE_BUILD_TYPE}
macro to generate different targets (qjson.lib/qjson.dll and qjsond.lib/qjsond.dll). Seems that the VS 2008 solution always builds with the qjson name (no qjsond on debug builds).
My horrible section of Makefile directives is as follows:
IF("${CMAKE_BUILD_TYPE}" MATCHES "^Rel.*")
add_library ( qjson SHARED ${qjson_SRCS} ${qjson_MOC_SRCS})
target_link_libraries( qjson ${QT_LIBRARIES})
set_target_properties( qjson PROPERTIES
VERSION ${QJSON_LIB_MAJOR_VERSION}.
${QJSON_LIB_MINOR_VERSION}.${QJSON_LIB_PATCH_VERSION}
SOVERSION ${QJSON_LIB_MAJOR_VERSION}
DEFINE_SYMBOL QJSON_MAKEDLL
)
INSTALL(TARGETS qjson
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
RUNTIME DESTINATION bin
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
)
ENDIF("${CMAKE_BUILD_TYPE}" MATCHES "^Rel.*")
IF("${CMAKE_BUILD_TYPE}" MATCHES "^Deb.*")
add_library ( qjsond SHARED ${qjson_SRCS} ${qjson_MOC_SRCS})
target_link_libraries( qjsond ${QT_LIBRARIES})
set_target_properties( qjsond PROPERTIES
VERSION ${QJSON_LIB_MAJOR_VERSION}.
${QJSON_LIB_MINOR_VERSION}.
${QJSON_LIB_PATCH_VERSION}
SOVERSION ${QJSON_LIB_MAJOR_VERSION}
DEFINE_SYMBOL QJSON_MAKEDLL
)
INSTALL(TARGETS qjsond
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
RUNTIME DESTINATION bin
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
)
ENDIF("${CMAKE_BUILD_TYPE}" MATCHES "^Deb.*")
Any ideas? Sure there's a simpler configuration. Thank you.