Note that there are some explanatory texts on larger screens.

plurals
  1. POCMake: How to generate different shared library names depending on build type
    primarykey
    data
    text
    <p>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 <code>${CMAKE_BUILD_TYPE}</code> 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).</p> <p>My horrible section of Makefile directives is as follows:</p> <pre><code> 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.*") </code></pre> <p>Any ideas? Sure there's a simpler configuration. Thank you.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload