From 9825945f657d1306ad310229b71af577ddd79e07 Mon Sep 17 00:00:00 2001 From: James Hogan Date: Mon, 15 Jun 2009 03:29:45 +0100 Subject: [PATCH] Allow SWORDless compilation. Fix out of place compilation where can't find generated header files --- cmake/modules/FindSword.cmake | 40 ++++++++++++++++++++++--------------- kworship/CMakeLists.txt | 1 + kworship/bible/sword/CMakeLists.txt | 8 +++++++- 3 files changed, 32 insertions(+), 17 deletions(-) diff --git a/cmake/modules/FindSword.cmake b/cmake/modules/FindSword.cmake index 114f332..a5f231b 100644 --- a/cmake/modules/FindSword.cmake +++ b/cmake/modules/FindSword.cmake @@ -6,6 +6,7 @@ SET (REQUIRED_SWORD_VERSION 1.5.9) # It will define the following values # SWORD_INCLUDE_DIR # SWORD_LIBS +# SWORD_FOUND If false, don't try to use sword. EXECUTE_PROCESS(COMMAND pkg-config --atleast-version=${REQUIRED_SWORD_VERSION} sword RESULT_VARIABLE SWORD_VERSION_OK @@ -21,26 +22,33 @@ IF (SWORD_VERSION_OK EQUAL 0) OUTPUT_VARIABLE SWORD_INCLUDE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE ) - MESSAGE(STATUS "Sword version ${SWORD_VERSION} is ok") - EXECUTE_PROCESS(COMMAND pkg-config --libs sword OUTPUT_VARIABLE SWORD_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE ) - MESSAGE(STATUS "Sword lib linker flags to be used: ${SWORD_LIBS}") + SET(SWORD_INCLUDE_DIR "${SWORD_INCLUDE_DIR}/sword") + + IF (NOT SWORD_FIND_QUIETLY) + MESSAGE(STATUS "Sword version ${SWORD_VERSION} is ok") + + MESSAGE(STATUS "Sword lib linker flags to be used: ${SWORD_LIBS}") + + MESSAGE(STATUS "Sword include directory is ${SWORD_INCLUDE_DIR}") + ENDIF (NOT SWORD_FIND_QUIETLY) + + MARK_AS_ADVANCED( + SWORD_INCLUDE_DIR + SWORD_LIBS + ) + SET(SWORD_FOUND TRUE) + ELSE (SWORD_VERSION_OK EQUAL 0) - IF (SWORD_VERSION) - MESSAGE(FATAL_ERROR "Sword version ${SWORD_VERSION} does not match the required ${REQUIRED_SWORD_VERSION}") - ELSE (SWORD_VERSION) - MESSAGE(FATAL_ERROR "Sword not found") - ENDIF (SWORD_VERSION) + IF (SWORD_FIND_REQUIRED) + IF (SWORD_VERSION) + MESSAGE(FATAL_ERROR "Sword version ${SWORD_VERSION} does not match the required ${REQUIRED_SWORD_VERSION}") + ELSE (SWORD_VERSION) + MESSAGE(FATAL_ERROR "Sword not found") + ENDIF (SWORD_VERSION) + ENDIF (SWORD_FIND_REQUIRED) ENDIF (SWORD_VERSION_OK EQUAL 0) - -SET(SWORD_INCLUDE_DIR "${SWORD_INCLUDE_DIR}/sword") -MESSAGE(STATUS "Sword include directory is ${SWORD_INCLUDE_DIR}") - -MARK_AS_ADVANCED( - SWORD_INCLUDE_DIR - SWORD_LIBS -) diff --git a/kworship/CMakeLists.txt b/kworship/CMakeLists.txt index ba45355..4737951 100644 --- a/kworship/CMakeLists.txt +++ b/kworship/CMakeLists.txt @@ -6,6 +6,7 @@ set(QT_USE_QTSQL 1) include(${QT_USE_FILE}) include_directories(${KDE4_INCLUDES} ${QT_INCLUDES} + ${CMAKE_CURRENT_BINARY_DIR} ../unipresent/common media display diff --git a/kworship/bible/sword/CMakeLists.txt b/kworship/bible/sword/CMakeLists.txt index ddb0c56..b9103ab 100644 --- a/kworship/bible/sword/CMakeLists.txt +++ b/kworship/bible/sword/CMakeLists.txt @@ -2,7 +2,11 @@ project(kworship_bible_sword) find_package(KDE4 REQUIRED) include (KDE4Defaults) -find_package(Sword REQUIRED) +find_package(Sword) + +if(NOT SWORD_FOUND) + message(STATUS "Sword plugin will not be built") +else(NOT SWORD_FOUND) set(kworship_bible_sword_SRCS KwBibleManagerSword.cpp @@ -23,3 +27,5 @@ target_link_libraries(kworship_bible_sword install( TARGETS kworship_bible_sword DESTINATION ${PLUGIN_INSTALL_DIR} ) install( FILES kworship_bible_sword.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + +endif(NOT SWORD_FOUND) -- 2.11.4.GIT