diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 57 |
1 files changed, 22 insertions, 35 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index abfd334..ac86555 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,9 +2,9 @@ cmake_minimum_required(VERSION 3.0) project(biboumi) -set(${PROJECT_NAME}_VERSION_MAJOR 8) -set(${PROJECT_NAME}_VERSION_MINOR 3) -set(${PROJECT_NAME}_VERSION_SUFFIX "") +set(${PROJECT_NAME}_VERSION_MAJOR 9) +set(${PROJECT_NAME}_VERSION_MINOR 0) +set(${PROJECT_NAME}_VERSION_SUFFIX "~dev") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) @@ -74,26 +74,11 @@ set(SOFTWARE_VERSION # ## The rule that generates the documentation # -execute_process(COMMAND "date" "+%Y-%m-%d" OUTPUT_VARIABLE DOC_DATE - OUTPUT_STRIP_TRAILING_WHITESPACE) -set(MAN_PAGE ${CMAKE_CURRENT_BINARY_DIR}/doc/${PROJECT_NAME}.1) -set(DOC_PAGE ${CMAKE_CURRENT_SOURCE_DIR}/doc/${PROJECT_NAME}.1.rst) -if (NOT PANDOC_EXECUTABLE) - find_program(PANDOC_EXECUTABLE NAMES pandoc - DOC "The pandoc software, to build the man page from the rst documentation") - if(PANDOC_EXECUTABLE) - message(STATUS "Found Pandoc: ${PANDOC_EXECUTABLE}") - set(WITH_DOC true) - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/) - add_custom_command(OUTPUT ${MAN_PAGE} - COMMAND ${PANDOC_EXECUTABLE} -M date="${DOC_DATE}" -s -t man ${DOC_PAGE} -o ${MAN_PAGE} - DEPENDS ${DOC_PAGE}) - add_custom_target(doc ALL DEPENDS ${MAN_PAGE}) - else() - message(STATUS "Pandoc not found, documentation cannot be built") - endif() -endif() -mark_as_advanced(PANDOC_EXECUTABLE) +add_custom_target(html COMMAND make html BUILDDIR=${CMAKE_CURRENT_BINARY_DIR} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc) +add_custom_target(man COMMAND make man BUILDDIR=${CMAKE_CURRENT_BINARY_DIR} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc) +add_custom_target(doc DEPENDS html man) # ## Set this search path for cmake, to find our custom search modules @@ -218,8 +203,6 @@ if(SQLITE3_FOUND OR PQ_FOUND) include_directories(database ${PQ_INCLUDE_DIRS}) endif() set(USE_DATABASE TRUE) -else() - add_library(database OBJECT "") endif() # @@ -235,8 +218,7 @@ add_executable(${PROJECT_NAME} src/main.cpp $<TARGET_OBJECTS:xmpp> $<TARGET_OBJECTS:bridge> $<TARGET_OBJECTS:irc> - $<TARGET_OBJECTS:identd> - $<TARGET_OBJECTS:database>) + $<TARGET_OBJECTS:identd>) ## test_suite file(GLOB source_tests @@ -249,9 +231,12 @@ add_executable(test_suite ${source_tests} $<TARGET_OBJECTS:xmpp> $<TARGET_OBJECTS:bridge> $<TARGET_OBJECTS:irc> - $<TARGET_OBJECTS:identd> - $<TARGET_OBJECTS:database>) + $<TARGET_OBJECTS:identd>) set_target_properties(test_suite PROPERTIES EXCLUDE_FROM_ALL TRUE) +if(USE_DATABASE) + target_sources(${PROJECT_NAME} PRIVATE $<TARGET_OBJECTS:database>) + target_sources(test_suite PRIVATE $<TARGET_OBJECTS:database>) +endif() # ## Link the executables with their libraries @@ -327,7 +312,9 @@ endif() ## Add some custom rules to launch the tests # add_custom_target(check COMMAND "test_suite" - DEPENDS test_suite biboumi) + DEPENDS test_suite) +add_custom_target(check_junit COMMAND test_suite -r junit -o check_result.xml + DEPENDS test_suite) set_target_properties(check PROPERTIES EXCLUDE_FROM_ALL TRUE) add_custom_target(e2e COMMAND "python3" "${CMAKE_CURRENT_SOURCE_DIR}/tests/end_to_end/" DEPENDS biboumi) @@ -338,13 +325,14 @@ if(CMAKE_BUILD_TYPE MATCHES Debug) include(CodeCoverage) SETUP_TARGET_FOR_COVERAGE(coverage_check ./test_suite - coverage_test_suite) + coverage_test_suite + "-o;check_result.xml;-r;junit") add_dependencies(coverage_check test_suite) SETUP_TARGET_FOR_COVERAGE(coverage_e2e python3 coverage_e2e - ${CMAKE_CURRENT_SOURCE_DIR}/tests/end_to_end/) + "${CMAKE_CURRENT_SOURCE_DIR}/tests/end_to_end/") add_dependencies(coverage_e2e biboumi) ADD_CUSTOM_TARGET(coverage @@ -361,7 +349,7 @@ add_custom_target(everything DEPENDS test_suite biboumi) ## Install target # install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin) -install(FILES ${MAN_PAGE} DESTINATION share/man/man1 OPTIONAL COMPONENT documentation) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/biboumi.1 DESTINATION share/man/man1 OPTIONAL COMPONENT documentation) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/biboumi.service DESTINATION lib/systemd/system COMPONENT init) file(GLOB policy_files conf/*policy.txt) install(FILES ${policy_files} DESTINATION /etc/biboumi COMPONENT configuration) @@ -397,12 +385,11 @@ add_custom_target(rpm # set(SYSTEMD_SERVICE_TYPE_DOCSTRING "The value used as the Type= in the systemd unit file.") set(WATCHDOG_SEC_DOCSTRING "The value used as WatchdogSec= in the systemd unit file.") +set(WATCHDOG_SEC "" CACHE STRING ${WATCHDOG_SEC_DOCSTRING}) if(SYSTEMD_FOUND) set(SYSTEMD_SERVICE_TYPE "notify" CACHE STRING ${SYSTEMD_SERVICE_TYPE_DOCSTRING}) - set(WATCHDOG_SEC "20" CACHE STRING ${WATCHDOG_SEC_DOCSTRING}) else() set(SYSTEMD_SERVICE_TYPE "simple" CACHE STRING ${SYSTEMD_SERVICE_TYPE_DOCSTRING}) - set(WATCHDOG_SEC "" CACHE STRING ${WATCHDOG_SEC_DOCSTRING}) endif() set(SERVICE_USER_DOCSTRING "The value used as the User= in the systemd unit file.") if(NOT DEFINED SERVICE_USER) |