[bt-devel] CMakeLists.txt Patch

Greg Hellings greg.hellings at gmail.com
Fri Sep 12 10:05:17 MST 2008


Martin,

On Fri, Sep 12, 2008 at 11:55 AM, Martin Gruner <mg.pub at gmx.net> wrote:
> Hi Greg,
>
> thanks a lot. I put it in SVN.
>
> Whenever we go away from KDE, MacOS integration will have to be redone, as
> KDE4_ADD_EXECUTABLE will not be available any more.

That shouldn't pose much of a problem, I've done it a few times now
with both KDE and the standard CMake macros, I'm starting to get the
hang of the differences.  Most of the changes won't need to be
replicated, and to make the standard ADD_EXECUTABLE to create a Mac OS
bundle, there is just an argument that gets passed in (called
MACOSX_BUNDLE) that should handle most of that magic.  Glad to be of
help.

--Greg

>
> mg
>
> Am Donnerstag, 11. September 2008 21:57:15 schrieb Greg Hellings:
>> Martin,
>>
>> On Thu, Sep 11, 2008 at 2:43 PM, Martin Gruner <mg.pub at gmx.net> wrote:
>> > Hi Greg,
>> >
>> > thank you for your changes. Can you please update CMakeLists.txt again
>> > from SVN and send me your renewed patch again, so that I can apply it on
>> > my current source? Sorry for the race-condition. =)
>>
>> Attached is the .diff file and appended below is its contents (in case
>> the list scrubs the attachment).
>>
>> > BTW, you changed the directory structure to match MacOS requirements. Did
>> > you also patch directoryutil.cpp? In its current implementation it
>> > requires the current directory structure or will fail because it does not
>> > find required directories. I guess this does not work with your new
>> > structure out of the box, does it?
>>
>> No changes to directoryutil.cpp were required.  By placing the
>> share/bibletime/* material directly inside of bibletime.app/Contents,
>> the files are picked up as being relative to the current install
>> directory, using the current code in directoryutil.cpp.  Thus, only
>> the CMakeLists.txt had to be changed.
>>
>> --Greg
>>
>> > mg
>>
>> Diff:
>> Index: CMakeLists.txt
>>
> ===================================================================
>> --- CMakeLists.txt    (revision 814)
>> +++ CMakeLists.txt    (working copy)
>> @@ -15,6 +15,8 @@
>>  # Find required packages
>>  #
>>  SET(QT_MIN_VERSION 4.4.0)
>> +SET(QT_USE_DBUS 1)
>> +SET(QT_USE_QTXML 1)
>>  FIND_PACKAGE(Qt4 REQUIRED)
>>  #
>>  # If cmake says that qdbusxml2cpp is missing, uncomment the following line
>> @@ -78,32 +80,30 @@
>>               PROPERTIES
>>                       COMPILE_FLAGS "-fexceptions" #Enable exception handling
>>       )
>> +     INCLUDE(${QT_USE_FILE})
>>       TARGET_LINK_LIBRARIES(bibletime
>>               ${KDE4_KDEUI_LIBS}
>>               ${KDE4_KDECORE_LIBS}
>>               ${KDE4_KHTML_LIBS}
>> -             QtCore
>> -             QtGui
>> -             QtXml
>> -             QtDBus
>> +             ${QT_LIBRARIES}
>>               ${CLUCENE_LIBRARY}
>>               ${SWORD_LIBS}
>>       )
>>  ELSE (CMAKE_BUILD_TYPE STREQUAL "Release")
>> +     SET(CMAKE_BUILD_TYPE "Debug")
>>       KDE4_ADD_EXECUTABLE(bibletime ${bibletime_SOURCES}
>> ${bibletime_test_SOURCES}) SET_TARGET_PROPERTIES(bibletime
>>               PROPERTIES
>>                       COMPILE_FLAGS "-fexceptions -DBT_ENABLE_TESTING" #Enable exception
>> handling and Testing
>>       )
>> +     SET(QT_USE_QTTEST 1)
>> +     INCLUDE(${QT_USE_FILE})
>>       TARGET_LINK_LIBRARIES(bibletime
>>               ${KDE4_KDEUI_LIBS}
>>               ${KDE4_KDECORE_LIBS}
>>               ${KDE4_KHTML_LIBS}
>> -             QtCore
>> -             QtGui
>> -             QtXml
>> -             QtDBus
>> -             QtTest
>> +             ${QT_LIBRARIES}
>> +             ${QT_LIBRARIES_DEBUG}
>>               ${CLUCENE_LIBRARY}
>>               ${SWORD_LIBS}
>>       )
>> @@ -118,70 +118,102 @@
>>
>>  ######################################################
>>
>> -IF (NOT CMAKE_INSTALL_PREFIX)
>> +IF (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
>>       SET(CMAKE_INSTALL_PREFIX "install/") #install to ./build/install,
>> allow override
>> -ENDIF (NOT CMAKE_INSTALL_PREFIX)
>> +ENDIF (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
>>
>> -SET(CMAKE_CXX_FLAGS "-W -O2")
>> -SET(CMAKE_CXX_FLAGS_DEBUG "-Wall -Werror -O0 -g") #-pedantic-errors
>> -SET(CMAKE_CXX_FLAGS_DEBUGFULL "-Wall -Werror -O0 -g") #-pedantic-errors
>> +SET(CMAKE_CXX_FLAGS_RELEASE "-W -O2")
>> +IF (NOT APPLE)
>> +     SET(CMAKE_CXX_FLAGS_DEBUG "-Wall -Werror -pedantic-errors -O0 -g")
>> +ELSE (NOT APPLE)
>> +     SET(CMAKE_CXX_FLAGS_DEBUG "-Wall -O0 -g")
>> +ENDIF (NOT APPLE)
>>
>> +SET(CMAKE_CXX_FLAGS_DEBUG_BINONLY ${CMAKE_CXX_FLAGS_DEBUG})
>> +SET(CMAKE_C_FLAGS_DEBUG_BINONLY ${CMAKE_C_FLAGS_DEBUG})
>> +SET(CMAKE_EXE_LINKER_FLAGS_DEBUG_BINONLY ${CMAKE_EXE_LINKER_FLAGS_DEBUG})
>> +SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG_BINONLY
>> ${CMAKE_SHARED_LINKER_FLAGS_DEBUG}) +MARK_AS_ADVANCED(
>> +     CMAKE_CXX_FLAGS_DEBUG_BINONLY
>> +     CMAKE_C_FLAGS_DEBUG_BINONLY
>> +     CMAKE_EXE_LINKER_FLAGS_DEBUG_BINONLY
>> +     CMAKE_SHARED_LINKER_FLAGS_DEBUG_BINONLY
>> +)
>> +
>> +
>>  ######################################################
>>  # Install files
>>  #
>> -# main binary
>> -INSTALL(TARGETS "bibletime"
>> -     DESTINATION "bin/"
>> +# main binary - Mac specifics handled by the KDE4_ADD_EXECUTABLE
>> +IF (APPLE)
>> +     SET (BT_DESTINATION ".")
>> +     SET (BT_SHARE_PATH bibletime.app/Contents/)
>> +ELSE (APPLE)
>> +     SET (BT_DESTINATION "bin/")
>> +     SET (BT_SHARE_PATH "")
>> +ENDIF (APPLE)
>> +INSTALL(TARGETS "bibletime"
>> +     DESTINATION "${BT_DESTINATION}"
>> +     CONFIGURATIONS Debug Release Debug_Binonly Debugfull
>>  )
>>  # compiled catalogs
>>  FOREACH(MESSAGE_LOCALE_LANG ${MESSAGE_LOCALE_LANGS})
>> -     INSTALL(FILES
>> "${CMAKE_CURRENT_SOURCE_DIR}/i18n/messages/bibletime_ui_${MESSAGE_LOCALE_LA
>>NG}.qm" -              DESTINATION "share/bibletime/locale/"
>> +     INSTALL(FILES
>> "${CMAKE_CURRENT_SOURCE_DIR}/i18n/messages/bibletime_ui_${MESSAGE_LOCALE_LA
>>NG}.qm" +              DESTINATION "${BT_SHARE_PATH}share/bibletime/locale/"
>> +             CONFIGURATIONS Debug Release Debugfull
>>       )
>>  ENDFOREACH(MESSAGE_LOCALE_LANG ${MESSAGE_LOCALE_LANGS})
>>  # icons
>>  FILE(GLOB INSTALL_ICONS_LIST
>> "${CMAKE_CURRENT_SOURCE_DIR}/pics/icons/*.svg") -INSTALL(FILES
>> ${INSTALL_ICONS_LIST}
>> -     DESTINATION "share/bibletime/icons/"
>> +INSTALL(FILES ${INSTALL_ICONS_LIST}
>> +     DESTINATION "${BT_SHARE_PATH}share/bibletime/icons/"
>> +     CONFIGURATIONS Debug Release Debugfull
>>  )
>>  # display templates
>>  FILE(GLOB INSTALL_DISPLAY_TEMPLATES_LIST
>> ${CMAKE_CURRENT_SOURCE_DIR}/src/display-templates/*.tmpl)
>> -INSTALL(FILES ${INSTALL_DISPLAY_TEMPLATES_LIST}
>> -     DESTINATION "share/bibletime/display-templates/"
>> +INSTALL(FILES ${INSTALL_DISPLAY_TEMPLATES_LIST}
>> +     DESTINATION "${BT_SHARE_PATH}share/bibletime/display-templates/"
>> +     CONFIGURATIONS Debug Release Debugfull
>>  )
>>  # splash screen
>> -INSTALL(FILES "pics/startuplogo.png"
>> -     DESTINATION "share/bibletime/pics/"
>> +INSTALL(FILES "pics/startuplogo.png"
>> +     DESTINATION "${BT_SHARE_PATH}share/bibletime/pics/"
>> +     CONFIGURATIONS Debug Release Debugfull
>>  )
>>  #handbook (install images from en/ to all languages)
>>  FILE(GLOB INSTALL_HANDBOOK_IMAGES
>> "${CMAKE_CURRENT_SOURCE_DIR}/docs/handbook/en/html/*.png")
>>  FOREACH(HANDBOOK_LOCALE_LANG ${HANDBOOK_LOCALE_LANGS} "en")
>>       FILE(GLOB INSTALL_HANDBOOK_HTML_FILES_${HANDBOOK_LOCALE_LANG}
>> "${CMAKE_CURRENT_SOURCE_DIR}/docs/handbook/${HANDBOOK_LOCALE_LANG}/html/*.h
>>tml") -        INSTALL(FILES ${INSTALL_HANDBOOK_HTML_FILES_${HANDBOOK_LOCALE_LANG}}
>> -             DESTINATION "share/bibletime/docs/handbook/${HANDBOOK_LOCALE_LANG}/"
>> +     INSTALL(FILES ${INSTALL_HANDBOOK_HTML_FILES_${HANDBOOK_LOCALE_LANG}}
>> +             DESTINATION
>> "${BT_SHARE_PATH}share/bibletime/docs/handbook/${HANDBOOK_LOCALE_LANG}/"
>> +             CONFIGURATIONS Debug Release Debugfull
>>       )
>> -     INSTALL(FILES ${INSTALL_HANDBOOK_IMAGES}
>> -             DESTINATION "share/bibletime/docs/handbook/${HANDBOOK_LOCALE_LANG}/"
>> +     INSTALL(FILES ${INSTALL_HANDBOOK_IMAGES}
>> +             DESTINATION
>> "${BT_SHARE_PATH}share/bibletime/docs/handbook/${HANDBOOK_LOCALE_LANG}/"
>> +             CONFIGURATIONS Debug Release Debugfull
>>       )
>>  ENDFOREACH(HANDBOOK_LOCALE_LANG ${HANDBOOK_LOCALE_LANGS} "en")
>>  #howto (does not have images)
>>  FOREACH(HOWTO_LOCALE_LANG ${HOWTO_LOCALE_LANGS} "en")
>>       FILE(GLOB INSTALL_HOWTO_HTML_FILES_${HOWTO_LOCALE_LANG}
>> "${CMAKE_CURRENT_SOURCE_DIR}/docs/howto/${HOWTO_LOCALE_LANG}/html/*.html")
>> -     INSTALL(FILES ${INSTALL_HOWTO_HTML_FILES_${HOWTO_LOCALE_LANG}}
>> -             DESTINATION "share/bibletime/docs/howto/${HOWTO_LOCALE_LANG}/"
>> +     INSTALL(FILES ${INSTALL_HOWTO_HTML_FILES_${HOWTO_LOCALE_LANG}}
>> +             DESTINATION
>> "${BT_SHARE_PATH}share/bibletime/docs/howto/${HOWTO_LOCALE_LANG}/"
>> +             CONFIGURATIONS Debug Release Debugfull
>>       )
>>  ENDFOREACH(HOWTO_LOCALE_LANG ${HOWTO_LOCALE_LANGS} "en")
>>  #
>>  # Platform specific installation
>>  #
>>  # LINUX: application icon
>> -INSTALL(FILES "${CMAKE_CURRENT_SOURCE_DIR}/pics/icons/bibletime.svg"
>> -     DESTINATION "share/icons/"
>> +INSTALL(FILES "${CMAKE_CURRENT_SOURCE_DIR}/pics/icons/bibletime.svg"
>> +     DESTINATION "${BT_SHARE_PATH}share/icons/"
>> +     CONFIGURATIONS Debug Release Debugfull
>>  )
>>  # LINUX: desktop file
>>
>> CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/cmake/platforms/linux/bibletime
>>.desktop.cmake" "${CMAKE_CURRENT_BINARY_DIR}/bibletime.desktop")
>> -INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/bibletime.desktop"
>> -     DESTINATION "share/applications/"
>> +INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/bibletime.desktop"
>> +     DESTINATION "${BT_SHARE_PATH}share/applications/"
>> +     CONFIGURATIONS Debug Release Debugfull
>>  )
>>  ######################################################
>
>
> _______________________________________________
> bt-devel mailing list
> bt-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/bt-devel
>



More information about the bt-devel mailing list