diff options
| -rw-r--r-- | modules/FindSoprano.cmake | 385 | 
1 files changed, 188 insertions, 197 deletions
| diff --git a/modules/FindSoprano.cmake b/modules/FindSoprano.cmake index 91148c14..aab22811 100644 --- a/modules/FindSoprano.cmake +++ b/modules/FindSoprano.cmake @@ -30,219 +30,210 @@  # For details see the accompanying COPYING-CMAKE-SCRIPTS file. -#if(SOPRANO_INCLUDE_DIR AND SOPRANO_LIBRARIES AND SOPRANO_INDEX_LIBRARIES AND SOPRANO_SERVER_LIBRARIES) - -  # read from cache -#  set(Soprano_FOUND TRUE) -#  set(SopranoServer_FOUND TRUE) -#  set(SopranoClient_FOUND TRUE) -#  set(SopranoIndex_FOUND TRUE) - -#else(SOPRANO_INCLUDE_DIR AND SOPRANO_LIBRARIES AND SOPRANO_INDEX_LIBRARIES AND SOPRANO_SERVER_LIBRARIES) -  include(FindLibraryWithDebug) - -  find_program(SOPRANO_SOPRANOCMD_EXECUTABLE -    NAMES sopranocmd  -    HINTS -    ${BIN_INSTALL_DIR} -    ${KDE4_BIN_INSTALL_DIR} -    ) +include(FindLibraryWithDebug) -  find_program(SOPRANO_ONTO2VOCABULARYCLASS_EXECUTABLE -    NAMES onto2vocabularyclass -    HINTS -    ${BIN_INSTALL_DIR} -    ${KDE4_BIN_INSTALL_DIR} -    ) +find_program(SOPRANO_SOPRANOCMD_EXECUTABLE +  NAMES sopranocmd  +  HINTS +  ${BIN_INSTALL_DIR} +  ${KDE4_BIN_INSTALL_DIR} +  ) +find_program(SOPRANO_ONTO2VOCABULARYCLASS_EXECUTABLE +  NAMES onto2vocabularyclass +  HINTS +  ${BIN_INSTALL_DIR} +  ${KDE4_BIN_INSTALL_DIR} +  ) -  find_path(SOPRANO_INCLUDE_DIR  -    NAMES -    soprano/soprano.h -    HINTS -    ${INCLUDE_INSTALL_DIR} -    ${KDE4_INCLUDE_DIR} -    ) -  find_library_with_debug(SOPRANO_INDEX_LIBRARIES  -    WIN32_DEBUG_POSTFIX d -    NAMES -    sopranoindex -    HINTS -    ${LIB_INSTALL_DIR} -    ${KDE4_LIB_DIR} -    ) +find_path(SOPRANO_INCLUDE_DIR  +  NAMES +  soprano/soprano.h +  HINTS +  ${INCLUDE_INSTALL_DIR} +  ${KDE4_INCLUDE_DIR} +  ) -  find_library_with_debug(SOPRANO_CLIENT_LIBRARIES  -    WIN32_DEBUG_POSTFIX d -    NAMES -    sopranoclient -    HINTS -    ${LIB_INSTALL_DIR} -    ${KDE4_LIB_DIR} -    ) +find_library_with_debug(SOPRANO_INDEX_LIBRARIES  +  WIN32_DEBUG_POSTFIX d +  NAMES +  sopranoindex +  HINTS +  ${LIB_INSTALL_DIR} +  ${KDE4_LIB_DIR} +  ) -  find_library_with_debug(SOPRANO_LIBRARIES -    WIN32_DEBUG_POSTFIX d -    NAMES soprano -    HINTS -    ${LIB_INSTALL_DIR} -    ${KDE4_LIB_DIR} +find_library_with_debug(SOPRANO_CLIENT_LIBRARIES  +  WIN32_DEBUG_POSTFIX d +  NAMES +  sopranoclient +  HINTS +  ${LIB_INSTALL_DIR} +  ${KDE4_LIB_DIR}    ) -  find_library_with_debug(SOPRANO_SERVER_LIBRARIES  -    WIN32_DEBUG_POSTFIX d +find_library_with_debug(SOPRANO_LIBRARIES +  WIN32_DEBUG_POSTFIX d +  NAMES soprano +  HINTS +  ${LIB_INSTALL_DIR} +  ${KDE4_LIB_DIR} +) + +find_library_with_debug(SOPRANO_SERVER_LIBRARIES  +  WIN32_DEBUG_POSTFIX d +  NAMES +  sopranoserver +  HINTS +  ${LIB_INSTALL_DIR} +  ${KDE4_LIB_DIR} +  ) + +# check for all the libs as required to make sure that we do not try to compile with an old version + +if(SOPRANO_INCLUDE_DIR AND SOPRANO_LIBRARIES) +  set(Soprano_FOUND TRUE) +endif(SOPRANO_INCLUDE_DIR AND SOPRANO_LIBRARIES) + +if(Soprano_FOUND AND SOPRANO_INDEX_LIBRARIES) +  set(SopranoIndex_FOUND TRUE) +endif(Soprano_FOUND AND SOPRANO_INDEX_LIBRARIES) + +if(Soprano_FOUND AND SOPRANO_CLIENT_LIBRARIES) +  set(SopranoClient_FOUND TRUE) +endif(Soprano_FOUND AND SOPRANO_CLIENT_LIBRARIES) + +if(Soprano_FOUND AND SOPRANO_SERVER_LIBRARIES) +  set(SopranoServer_FOUND TRUE) +endif(Soprano_FOUND AND SOPRANO_SERVER_LIBRARIES) + +# check Soprano version + +# We set a default for the minimum required version to be backwards compatible +if(NOT SOPRANO_MIN_VERSION) +  set(SOPRANO_MIN_VERSION "1.99") +endif(NOT SOPRANO_MIN_VERSION) + +if(Soprano_FOUND) +  file(READ ${SOPRANO_INCLUDE_DIR}/soprano/version.h SOPRANO_VERSION_CONTENT) +  string(REGEX MATCH "SOPRANO_VERSION_STRING \".*\"\n" SOPRANO_VERSION_MATCH ${SOPRANO_VERSION_CONTENT}) +  if(SOPRANO_VERSION_MATCH) +    string(REGEX REPLACE "SOPRANO_VERSION_STRING \"(.*)\"\n" "\\1" SOPRANO_VERSION ${SOPRANO_VERSION_MATCH}) +    if(SOPRANO_VERSION STRLESS "${SOPRANO_MIN_VERSION}") +      set(Soprano_FOUND FALSE) +      if(Soprano_FIND_REQUIRED) +        message(FATAL_ERROR "Soprano version ${SOPRANO_VERSION} is too old. Please install ${SOPRANO_MIN_VERSION} or newer") +      else(Soprano_FIND_REQUIRED) +        message(STATUS "Soprano version ${SOPRANO_VERSION} is too old. Please install ${SOPRANO_MIN_VERSION} or newer") +      endif(Soprano_FIND_REQUIRED) +    endif(SOPRANO_VERSION STRLESS "${SOPRANO_MIN_VERSION}") +  endif(SOPRANO_VERSION_MATCH) +endif(Soprano_FOUND) + + +#look for parser plugins +if(Soprano_FOUND) +  find_path(SOPRANO_PLUGIN_ROOT_DIR       NAMES -    sopranoserver -    HINTS -    ${LIB_INSTALL_DIR} -    ${KDE4_LIB_DIR} +    soprano/plugins +    PATHS +    ${SOPRANO_INCLUDE_DIR}/../share +    ${SHARE_INSTALL_PREFIX}  +    /usr/share  +    /usr/local/share +    NO_DEFAULT_PATH +    NO_SYSTEM_ENVIRONMENT_PATH      ) - -  # check for all the libs as required to make sure that we do not try to compile with an old version - -  if(SOPRANO_INCLUDE_DIR AND SOPRANO_LIBRARIES) -    set(Soprano_FOUND TRUE) -  endif(SOPRANO_INCLUDE_DIR AND SOPRANO_LIBRARIES) - -  if(Soprano_FOUND AND SOPRANO_INDEX_LIBRARIES) -    set(SopranoIndex_FOUND TRUE) -  endif(Soprano_FOUND AND SOPRANO_INDEX_LIBRARIES) - -  if(Soprano_FOUND AND SOPRANO_CLIENT_LIBRARIES) -    set(SopranoClient_FOUND TRUE) -  endif(Soprano_FOUND AND SOPRANO_CLIENT_LIBRARIES) - -  if(Soprano_FOUND AND SOPRANO_SERVER_LIBRARIES) -    set(SopranoServer_FOUND TRUE) -  endif(Soprano_FOUND AND SOPRANO_SERVER_LIBRARIES) -   -  # check Soprano version - -  # We set a default for the minimum required version to be backwards compatible -  if(NOT SOPRANO_MIN_VERSION) -    set(SOPRANO_MIN_VERSION "1.99") -  endif(NOT SOPRANO_MIN_VERSION) - -  if(Soprano_FOUND) -    file(READ ${SOPRANO_INCLUDE_DIR}/soprano/version.h SOPRANO_VERSION_CONTENT) -    string(REGEX MATCH "SOPRANO_VERSION_STRING \".*\"\n" SOPRANO_VERSION_MATCH ${SOPRANO_VERSION_CONTENT}) -    if(SOPRANO_VERSION_MATCH) -      string(REGEX REPLACE "SOPRANO_VERSION_STRING \"(.*)\"\n" "\\1" SOPRANO_VERSION ${SOPRANO_VERSION_MATCH}) -      if(SOPRANO_VERSION STRLESS "${SOPRANO_MIN_VERSION}") -        set(Soprano_FOUND FALSE) -        if(Soprano_FIND_REQUIRED) -          message(FATAL_ERROR "Soprano version ${SOPRANO_VERSION} is too old. Please install ${SOPRANO_MIN_VERSION} or newer") -        else(Soprano_FIND_REQUIRED) -          message(STATUS "Soprano version ${SOPRANO_VERSION} is too old. Please install ${SOPRANO_MIN_VERSION} or newer") -        endif(Soprano_FIND_REQUIRED) -      endif(SOPRANO_VERSION STRLESS "${SOPRANO_MIN_VERSION}") -    endif(SOPRANO_VERSION_MATCH) -  endif(Soprano_FOUND) - - -  #look for parser plugins -  if(Soprano_FOUND) -    find_path(SOPRANO_PLUGIN_DIR  -      NAMES -      soprano/plugins -      PATHS -      ${SOPRANO_INCLUDE_DIR}/../share -      ${SHARE_INSTALL_PREFIX}  -      /usr/share  -      /usr/local/share -      NO_DEFAULT_PATH -      NO_SYSTEM_ENVIRONMENT_PATH -      ) -    set(SOPRANO_PLUGIN_DIR "${SOPRANO_PLUGIN_DIR}/soprano/plugins") - -    if(EXISTS ${SOPRANO_PLUGIN_DIR}/nquadparser.desktop) -      set(SOPRANO_PLUGIN_NQUADPARSER_FOUND TRUE) -      set(_plugins "${_plugins} nquadparser") -    endif(EXISTS ${SOPRANO_PLUGIN_DIR}/nquadparser.desktop) - -    if(EXISTS ${SOPRANO_PLUGIN_DIR}/nquadserializer.desktop) -      set(SOPRANO_PLUGIN_NQUADSERIALIZER_FOUND TRUE) -      set(_plugins "${_plugins} nquadserializer") -    endif(EXISTS ${SOPRANO_PLUGIN_DIR}/nquadserializer.desktop) - -    if(EXISTS ${SOPRANO_PLUGIN_DIR}/raptorparser.desktop) -      set(SOPRANO_PLUGIN_RAPTORPARSER_FOUND TRUE) -      set(_plugins "${_plugins} raptorparser") -    endif(EXISTS ${SOPRANO_PLUGIN_DIR}/raptorparser.desktop) - -    if(EXISTS ${SOPRANO_PLUGIN_DIR}/raptorserializer.desktop) -      set(SOPRANO_PLUGIN_RAPTORSERIALIZER_FOUND TRUE) -      set(_plugins "${_plugins} raptorserializer") -    endif(EXISTS ${SOPRANO_PLUGIN_DIR}/raptorserializer.desktop) - -    if(EXISTS ${SOPRANO_PLUGIN_DIR}/redlandbackend.desktop) -      set(SOPRANO_PLUGIN_REDLANDBACKEND_FOUND TRUE) -      set(_plugins "${_plugins} redlandbackend") -    endif(EXISTS ${SOPRANO_PLUGIN_DIR}/redlandbackend.desktop) - -    if(EXISTS ${SOPRANO_PLUGIN_DIR}/sesame2backend.desktop) -      set(SOPRANO_PLUGIN_SESAME2BACKEND_FOUND TRUE) -      set(_plugins "${_plugins} sesame2backend") -    endif(EXISTS ${SOPRANO_PLUGIN_DIR}/sesame2backend.desktop) - -    if(EXISTS ${SOPRANO_PLUGIN_DIR}/virtuosobackend.desktop) -      set(SOPRANO_PLUGIN_VIRTUOSOBACKEND_FOUND TRUE) -      set(_plugins "${_plugins} virtuosobackend") -    endif(EXISTS ${SOPRANO_PLUGIN_DIR}/virtuosobackend.desktop) - -    # make sure the Soprano cmake macros are found -    # We also include it directly for convinience -    get_filename_component(_SOPRANO_PREFIX ${SOPRANO_INCLUDE_DIR} PATH) -    find_file(_SOPRANO_MACRO_FILE NAMES SopranoAddOntology.cmake HINTS ${_SOPRANO_PREFIX}/share/soprano/cmake ) -    if(_SOPRANO_MACRO_FILE) -      # new Soprano > 2.3.0 location -      include(${_SOPRANO_MACRO_FILE}) -      set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${_SOPRANO_PREFIX}/share/soprano/cmake) -    else(_SOPRANO_MACRO_FILE) -      # the old Soprano 2.3.0 location -      find_file(_SOPRANO_MACRO_FILE_OLD NAMES SopranoAddOntology.cmake HINTS ${_SOPRANO_PREFIX}/share/apps/cmake/modules ) -      if(_SOPRANO_MACRO_FILE_OLD) -        include(${_SOPRANO_MACRO_FILE_OLD}) -        set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${_SOPRANO_PREFIX}/share/apps/cmake/modules) -      endif(_SOPRANO_MACRO_FILE_OLD) -    endif(_SOPRANO_MACRO_FILE) - -  endif(Soprano_FOUND) - -  if(Soprano_FOUND) -    if(NOT Soprano_FIND_QUIETLY) -      message(STATUS "Found Soprano version ${SOPRANO_VERSION}: ${SOPRANO_LIBRARIES}") -      message(STATUS "Found Soprano includes: ${SOPRANO_INCLUDE_DIR}") -      message(STATUS "Found Soprano Index: ${SOPRANO_INDEX_LIBRARIES}") -      message(STATUS "Found Soprano Client: ${SOPRANO_CLIENT_LIBRARIES}") -      message(STATUS "Found Soprano Plugin Dir: ${SOPRANO_PLUGIN_DIR}") -      message(STATUS "Found Soprano Plugins:${_plugins}") -    endif(NOT Soprano_FIND_QUIETLY) -  else(Soprano_FOUND) -    if(Soprano_FIND_REQUIRED) -      if(NOT SOPRANO_INCLUDE_DIR) -        message(FATAL_ERROR "Could not find Soprano includes.") -      endif(NOT SOPRANO_INCLUDE_DIR) -      if(NOT SOPRANO_LIBRARIES) -        message(FATAL_ERROR "Could not find Soprano library.") -      endif(NOT SOPRANO_LIBRARIES) -    else(Soprano_FIND_REQUIRED) -      if(NOT SOPRANO_INCLUDE_DIR) -        message(STATUS "Could not find Soprano includes.") -      endif(NOT SOPRANO_INCLUDE_DIR) -      if(NOT SOPRANO_LIBRARIES) -        message(STATUS "Could not find Soprano library.") -      endif(NOT SOPRANO_LIBRARIES) -    endif(Soprano_FIND_REQUIRED) -  endif(Soprano_FOUND) +  set(SOPRANO_PLUGIN_DIR "${SOPRANO_PLUGIN_ROOT_DIR}/soprano/plugins") + +  if(EXISTS ${SOPRANO_PLUGIN_DIR}/nquadparser.desktop) +    set(SOPRANO_PLUGIN_NQUADPARSER_FOUND TRUE) +    set(_plugins "${_plugins} nquadparser") +  endif(EXISTS ${SOPRANO_PLUGIN_DIR}/nquadparser.desktop) + +  if(EXISTS ${SOPRANO_PLUGIN_DIR}/nquadserializer.desktop) +    set(SOPRANO_PLUGIN_NQUADSERIALIZER_FOUND TRUE) +    set(_plugins "${_plugins} nquadserializer") +  endif(EXISTS ${SOPRANO_PLUGIN_DIR}/nquadserializer.desktop) + +  if(EXISTS ${SOPRANO_PLUGIN_DIR}/raptorparser.desktop) +    set(SOPRANO_PLUGIN_RAPTORPARSER_FOUND TRUE) +    set(_plugins "${_plugins} raptorparser") +  endif(EXISTS ${SOPRANO_PLUGIN_DIR}/raptorparser.desktop) + +  if(EXISTS ${SOPRANO_PLUGIN_DIR}/raptorserializer.desktop) +    set(SOPRANO_PLUGIN_RAPTORSERIALIZER_FOUND TRUE) +    set(_plugins "${_plugins} raptorserializer") +  endif(EXISTS ${SOPRANO_PLUGIN_DIR}/raptorserializer.desktop) + +  if(EXISTS ${SOPRANO_PLUGIN_DIR}/redlandbackend.desktop) +    set(SOPRANO_PLUGIN_REDLANDBACKEND_FOUND TRUE) +    set(_plugins "${_plugins} redlandbackend") +  endif(EXISTS ${SOPRANO_PLUGIN_DIR}/redlandbackend.desktop) + +  if(EXISTS ${SOPRANO_PLUGIN_DIR}/sesame2backend.desktop) +    set(SOPRANO_PLUGIN_SESAME2BACKEND_FOUND TRUE) +    set(_plugins "${_plugins} sesame2backend") +  endif(EXISTS ${SOPRANO_PLUGIN_DIR}/sesame2backend.desktop) + +  if(EXISTS ${SOPRANO_PLUGIN_DIR}/virtuosobackend.desktop) +    set(SOPRANO_PLUGIN_VIRTUOSOBACKEND_FOUND TRUE) +    set(_plugins "${_plugins} virtuosobackend") +  endif(EXISTS ${SOPRANO_PLUGIN_DIR}/virtuosobackend.desktop) + +  # make sure the Soprano cmake macros are found +  # We also include it directly for convinience +  get_filename_component(_SOPRANO_PREFIX ${SOPRANO_INCLUDE_DIR} PATH) +  find_file(_SOPRANO_MACRO_FILE NAMES SopranoAddOntology.cmake HINTS ${_SOPRANO_PREFIX}/share/soprano/cmake ) +  if(_SOPRANO_MACRO_FILE) +    # new Soprano > 2.3.0 location +    include(${_SOPRANO_MACRO_FILE}) +    set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${_SOPRANO_PREFIX}/share/soprano/cmake) +  else(_SOPRANO_MACRO_FILE) +    # the old Soprano 2.3.0 location +    find_file(_SOPRANO_MACRO_FILE_OLD NAMES SopranoAddOntology.cmake HINTS ${_SOPRANO_PREFIX}/share/apps/cmake/modules ) +    if(_SOPRANO_MACRO_FILE_OLD) +      include(${_SOPRANO_MACRO_FILE_OLD}) +      set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${_SOPRANO_PREFIX}/share/apps/cmake/modules) +    endif(_SOPRANO_MACRO_FILE_OLD) +  endif(_SOPRANO_MACRO_FILE) + +endif(Soprano_FOUND) + +if(Soprano_FOUND) +  if(NOT Soprano_FIND_QUIETLY) +    message(STATUS "Found Soprano version ${SOPRANO_VERSION}: ${SOPRANO_LIBRARIES}") +    message(STATUS "Found Soprano includes: ${SOPRANO_INCLUDE_DIR}") +    message(STATUS "Found Soprano Index: ${SOPRANO_INDEX_LIBRARIES}") +    message(STATUS "Found Soprano Client: ${SOPRANO_CLIENT_LIBRARIES}") +    message(STATUS "Found Soprano Plugin Dir: ${SOPRANO_PLUGIN_DIR}") +    message(STATUS "Found Soprano Plugins:${_plugins}") +  endif(NOT Soprano_FIND_QUIETLY) +else(Soprano_FOUND) +  if(Soprano_FIND_REQUIRED) +    if(NOT SOPRANO_INCLUDE_DIR) +      message(FATAL_ERROR "Could not find Soprano includes.") +    endif(NOT SOPRANO_INCLUDE_DIR) +    if(NOT SOPRANO_LIBRARIES) +      message(FATAL_ERROR "Could not find Soprano library.") +    endif(NOT SOPRANO_LIBRARIES) +  else(Soprano_FIND_REQUIRED) +    if(NOT SOPRANO_INCLUDE_DIR) +      message(STATUS "Could not find Soprano includes.") +    endif(NOT SOPRANO_INCLUDE_DIR) +    if(NOT SOPRANO_LIBRARIES) +      message(STATUS "Could not find Soprano library.") +    endif(NOT SOPRANO_LIBRARIES) +  endif(Soprano_FIND_REQUIRED) +endif(Soprano_FOUND)  mark_as_advanced(SOPRANO_CLIENT_LIBRARIES                    SOPRANO_INDEX_LIBRARIES                   SOPRANO_LIBRARIES                   SOPRANO_SERVER_LIBRARIES                   SOPRANO_INCLUDE_DIR -                 SOPRANO_PLUGIN_DIR +                 SOPRANO_PLUGIN_ROOT_DIR                   _SOPRANO_MACRO_FILE                   SOPRANO_ONTO2VOCABULARYCLASS_EXECUTABLE                   SOPRANO_SOPRANOCMD_EXECUTABLE | 
