2009-11-21 16 views
1

C'est la première fois que j'utilise CMake et j'essaye de construire QJSon, un analyseur JSON pour Qt 4.x. Ce que je veux essentiellement, c'est construire différents noms de bibliothèques de sortie en fonction de la configuration de construction. J'utilise macro ${CMAKE_BUILD_TYPE} pour générer des cibles différentes (qjson.lib/qjson.dll et qjsond.lib/qjsond.dll). Il semble que la solution VS 2008 soit toujours construite avec le nom qjson (pas de qjsond sur les builds de débogage).CMake: Comment générer différents noms de bibliothèques partagées en fonction du type de construction

section Mon horrible directives Makefile est la suivante:

 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.*") 

Toutes les idées? Bien sûr, il y a une configuration plus simple. Je vous remercie.

Répondre