This is a bit better one, tell me what do you think.
Unfortunately I cannot use macro_optional_find_package() everywhere as it
creates variable with name ENABLE_${pkgname} where pkgname is cmake
Find${pkgname} module name, and in case of Sesame2 it would be WITH_JNI -
pretty much non-informative.
So, as summary is already displayed, I decided to just add option() and not
make use of macro_optional_find_package and macro_log_feature.
Besides macro_optional_find_package adds variable with WITH_ prefix (and when
I cannot use it in sesame, it would result in WITH_Redland, ENABLE_Sesam2 -
and both are storage backends - it would be bad).
Besides I added ENABLE_docs for apidox generation as well and ENABLE_tests for
building tests.
As far as tests are concerned, ctest scans all targets that have been built in
project(${projectname}_test) as I suppose, and only these tests are build for
those prerequisites have been found, so no test for non-existing backend will
be run (this is what Ingmar was afraid of) - this has been verified.
About macros, I find them not yet flexible as one would expect (or maybe
there's some macro I don't know about) - what I would like to have in *one*
macro and what I'm probably going to write in a future:
- ability to add package module name in macro (already in
macro_optional_find_package)
- ability to specify variable prefix (WITH_ or ENABLE_ or some other) and of
course default value
- ability to specify description/homepage (something like in
macro_log_feature)
- ability to specify whether package is required (variable would not be
specified - maybe I could write another version of this macro for finding
packages that are required)
- ability to specify package version along with version operator (and
automatic verification - setting to NOTFOUND when too old or just not the one
as requested) - unfortunately - all FindXXX modules or some other mechanism
would need to start returning detected package version.
So macro_log_feature with macro_optional_find_package combined.
cheers
--
regards
MM
-----------------------------------------------------------------------
Promocja w Speak Up. Kwartal angielskiego za darmo.
3 miesiace nauki gratis. Sprawdz teraz! >> http://link.interia.pl/f2019
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt (revision 918069)
+++ CMakeLists.txt (working copy)
@@ -1,4 +1,4 @@
-project(soprano)
+project(soprano)
cmake_minimum_required(VERSION 2.6.2)
@@ -9,10 +9,8 @@
set(CMAKE_SOPRANO_VERSION_RELEASE 60)
set(CMAKE_SOPRANO_VERSION_STRING "${CMAKE_SOPRANO_VERSION_MAJOR}.${CMAKE_SOPRANO_VERSION_MINOR}.${CMAKE_SOPRANO_VERSION_RELEASE}")
-enable_testing()
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
-
if(WIN32)
set(CMAKE_DEBUG_POSTFIX "d")
endif(WIN32)
@@ -20,37 +18,45 @@
################## find packages ################################
set(QT_MIN_VERSION "4.4.0")
-find_package(Qt4 REQUIRED)
+find_package(Qt4 REQUIRED)
# properly set up compile flags (QT_DEBUG/QT_NO_DEBUG, ...)
include(${QT_USE_FILE})
-find_package(Redland)
+option(ENABLE_Redland "Raptor RDF parser/serializer and Redland storage backend" OFF)
+if(ENABLE_Redland)
+ find_package(Redland)
+endif(ENABLE_Redland)
-find_package(CLucene)
-if(CLucene_FOUND)
- if(CLUCENE_VERSION AND CLUCENE_VERSION STRGREATER "0.9.19" OR CLUCENE_VERSION STREQUAL "0.9.19")
- set(CL_VERSION_19_OR_GREATER TRUE)
- endif(CLUCENE_VERSION AND CLUCENE_VERSION STRGREATER "0.9.19" OR CLUCENE_VERSION STREQUAL "0.9.19")
- set(SOPRANO_BUILD_INDEX_LIB 1 CACHE INTERNAL "Soprano Index is built" FORCE)
-endif(CLucene_FOUND)
+option(ENABLE_CLucene "CLucene-based full-text search index library" ON)
+if(ENABLE_CLucene)
+ find_package(CLucene)
+ if(CLucene_FOUND)
+ if(CLUCENE_VERSION AND CLUCENE_VERSION STRGREATER "0.9.19" OR CLUCENE_VERSION STREQUAL "0.9.19")
+ set(CL_VERSION_19_OR_GREATER TRUE)
+ endif(CLUCENE_VERSION AND CLUCENE_VERSION STRGREATER "0.9.19" OR CLUCENE_VERSION STREQUAL "0.9.19")
+ set(SOPRANO_BUILD_INDEX_LIB 1 CACHE INTERNAL "Soprano Index is built" FORCE)
+ endif(CLucene_FOUND)
+endif(ENABLE_CLucene)
-find_package(JNI)
-if(JAVA_INCLUDE_PATH AND JAVA_JVM_LIBRARY)
- file(READ ${JAVA_INCLUDE_PATH}/jni.h jni_header_data)
- string(REGEX MATCH "JNI_VERSION_1_4" JNI_1_4_FOUND "${jni_header_data}")
- if(JNI_1_4_FOUND)
- message(STATUS "Found Java JNI >= 1.4: ${JAVA_INCLUDE_PATH}, ${JAVA_JVM_LIBRARY}")
- else(JNI_1_4_FOUND)
- message( "Need JNI version 1.4 or higher for the Sesame2 backend.")
- endif(JNI_1_4_FOUND)
-else(JAVA_INCLUDE_PATH AND JAVA_JVM_LIBRARY)
- message(STATUS "Could not find Java JNI")
- if("$ENV{JAVA_HOME}" STREQUAL "")
- message("Make sure JAVA_HOME is set")
- endif("$ENV{JAVA_HOME}" STREQUAL "")
-endif(JAVA_INCLUDE_PATH AND JAVA_JVM_LIBRARY)
+option(ENABLE_Sesame2 "Sesame2 storage backend (java-based)" ON)
+if(ENABLE_Sesame2)
+ find_package(JNI)
+ if(JAVA_INCLUDE_PATH AND JAVA_JVM_LIBRARY)
+ file(READ ${JAVA_INCLUDE_PATH}/jni.h jni_header_data)
+ string(REGEX MATCH "JNI_VERSION_1_4" JNI_1_4_FOUND "${jni_header_data}")
+ if(JNI_1_4_FOUND)
+ message(STATUS "Found Java JNI >= 1.4: ${JAVA_INCLUDE_PATH}, ${JAVA_JVM_LIBRARY}")
+ else(JNI_1_4_FOUND)
+ message( "Need JNI version 1.4 or higher for the Sesame2 backend.")
+ endif(JNI_1_4_FOUND)
+ else(JAVA_INCLUDE_PATH AND JAVA_JVM_LIBRARY)
+ message(STATUS "Could not find Java JNI")
+ if("$ENV{JAVA_HOME}" STREQUAL "")
+ message("Make sure JAVA_HOME is set")
+ endif("$ENV{JAVA_HOME}" STREQUAL "")
+ endif(JAVA_INCLUDE_PATH AND JAVA_JVM_LIBRARY)
+endif(ENABLE_Sesame2)
-
################## setup install directories ################################
set (LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
set (LIB_DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE STRING "Library directory name")
@@ -63,40 +69,47 @@
# By default cmake builds the targets with full RPATH to everything in the build directory,
# but then removes the RPATH when installing.
# These two options below make it set the RPATH of the installed targets to all
-# RPATH directories outside the current CMAKE_BINARY_DIR and also the library
+# RPATH directories outside the current CMAKE_BINARY_DIR and also the library
# install directory. Alex
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
-set(CMAKE_INSTALL_RPATH ${LIB_DESTINATION} )
+set(CMAKE_INSTALL_RPATH ${LIB_DESTINATION})
if(APPLE)
- set(CMAKE_INSTALL_NAME_DIR ${LIB_DESTINATION})
+ set(CMAKE_INSTALL_NAME_DIR ${LIB_DESTINATION})
endif(APPLE)
################## some compiler settings ################################
if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32 )
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-check-new -fno-common")
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-check-new -fno-common")
endif(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32 )
if(MSVC)
- add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -Zc:wchar_t-)
+ add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -Zc:wchar_t-)
endif(MSVC)
if(MINGW)
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -Wpointer-arith -Wformat-security -fno-check-new -fno-common")
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -Wpointer-arith -Wformat-security -fno-check-new -fno-common")
endif(MINGW)
################## add subdirectories ################################
if(CLucene_FOUND)
- add_subdirectory(index)
+ add_subdirectory(index)
endif(CLucene_FOUND)
-add_subdirectory(soprano)
+
+add_subdirectory(soprano)
add_subdirectory(backends)
add_subdirectory(parsers)
add_subdirectory(serializers)
#add_subdirectory(queryparsers)
add_subdirectory(server)
add_subdirectory(tools)
-add_subdirectory(test)
+
+option(ENABLE_tests "Parser/storage backend tests)" ON)
+if(ENABLE_tests)
+ enable_testing()
+ add_subdirectory(test)
+endif(ENABLE_tests)
+
add_subdirectory(rules)
add_subdirectory(includes)
@@ -109,24 +122,26 @@
################## apidox ################################
-find_package(Doxygen)
+option(ENABLE_docs "API documentation" ON)
+if(ENABLE_docs)
+ find_package(Doxygen)
-if(DOXYGEN_EXECUTABLE)
- configure_file(${soprano_SOURCE_DIR}/Doxyfile.cmake ${soprano_BINARY_DIR}/Doxyfile)
+ if(DOXYGEN_EXECUTABLE)
+ configure_file(${soprano_SOURCE_DIR}/Doxyfile.cmake ${soprano_BINARY_DIR}/Doxyfile)
- if(EXISTS ${QT_DOC_DIR}/html)
- set(QTDOCS "${QT_DOC_DIR}/html")
- else(EXISTS ${QT_DOC_DIR}/html)
- set(QTDOCS "http://doc.trolltech.com/4.3/")
- endif(EXISTS ${QT_DOC_DIR}/html)
+ if(EXISTS ${QT_DOC_DIR}/html)
+ set(QTDOCS "${QT_DOC_DIR}/html")
+ else(EXISTS ${QT_DOC_DIR}/html)
+ set(QTDOCS "http://doc.trolltech.com/4.3/")
+ endif(EXISTS ${QT_DOC_DIR}/html)
- add_custom_target(
- apidox
- COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile
- COMMAND docs/html/installdox -l qt4....@${qtdocs} docs/html/*.html)
-endif(DOXYGEN_EXECUTABLE)
+ add_custom_target(
+ apidox
+ COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile
+ COMMAND docs/html/installdox -l qt4....@${qtdocs} docs/html/*.html)
+ endif(DOXYGEN_EXECUTABLE)
+endif(ENABLE_docs)
-
################## status messages ################################
message("---------------------------------------------------------------------------------------")
message("-- Soprano Components that will be built:")
_______________________________________________
Kde-buildsystem mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-buildsystem