From b2da4160d7e93dca400ad1ce776d916756a5eb6a Mon Sep 17 00:00:00 2001 From: David Bears Date: Fri, 21 Aug 2026 14:10:31 -0400 Subject: [PATCH] a few more CMake touch-ups --- CMakeLists.txt | 36 +++++++++---------- src/jsonapi/CMakeLists.txt | 5 --- src/jsonapi/jsonapi-generator-doxygen.conf.in | 2 +- src/rsserver/rsinit.cc | 6 +--- 4 files changed, 19 insertions(+), 30 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ff79d42bf..2f961d686 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -229,9 +229,13 @@ set(LIBRS_MINI_VERSION "${PROJECT_VERSION_PATCH}") if(DEFINED RS_EXTRA_VERSION AND NOT (RS_EXTRA_VERSION STREQUAL "")) set(LIBRS_EXTRA_VERSION "${RS_EXTRA_VERSION}") else() - git_describe_working_tree(V_GIT_DESCRIBE --tags --long --always --dirty --match v*.*.*) + git_describe_working_tree(V_GIT_DESCRIBE + --tags --long --always --dirty --match v*.*.* + ) set(V_GIT_DESCRIBE_REGEXP "^v([0-9]+).([0-9]+).([0-9]+)(.*)$") - if(V_GIT_DESCRIBE AND V_GIT_DESCRIBE MATCHES "${V_GIT_DESCRIBE_REGEXP}") + if(NOT V_GIT_DESCRIBE) + set(LIBRS_EXTRA_VERSION "-unknown") + elseif(V_GIT_DESCRIBE MATCHES "${V_GIT_DESCRIBE_REGEXP}") string( REGEX REPLACE "${V_GIT_DESCRIBE_REGEXP}" "\\1;\\2;\\3;\\4" @@ -240,13 +244,17 @@ else() list(GET V_GIT_DESCRIBE_LIST 1 LIBRS_MINOR_VERSION) list(GET V_GIT_DESCRIBE_LIST 2 LIBRS_MINI_VERSION) list(GET V_GIT_DESCRIBE_LIST 3 LIBRS_EXTRA_VERSION) - elseif(V_GIT_DESCRIBE) - set(LIBRS_EXTRA_VERSION "-${V_GIT_DESCRIBE}") else() - set(LIBRS_EXTRA_VERSION "-unknown") + set(LIBRS_EXTRA_VERSION "-${V_GIT_DESCRIBE}") endif() endif() -message(STATUS "libRetroShare version ${LIBRS_MAJOR_VERSION}.${LIBRS_MINOR_VERSION}.${LIBRS_MINI_VERSION}${LIBRS_EXTRA_VERSION}") +string(CONCAT LIBRS_FULL_VERSION + ${LIBRS_MAJOR_VERSION} + .${LIBRS_MINOR_VERSION} + .${LIBRS_MINI_VERSION} + "${LIBRS_EXTRA_VERSION}" +) +message(STATUS "libretroshare version ${LIBRS_FULL_VERSION}") ################################################################################ @@ -290,6 +298,7 @@ target_link_libraries(${PROJECT_NAME} target_compile_definitions(${PROJECT_NAME} PUBLIC + "LIBRS_FULL_VERSION=${LIBRS_FULL_VERSION}" "LIBRS_MAJOR_VERSION=${LIBRS_MAJOR_VERSION}" "LIBRS_MINOR_VERSION=${LIBRS_MINOR_VERSION}" "LIBRS_MINI_VERSION=${LIBRS_MINI_VERSION}" @@ -439,7 +448,6 @@ endif(RS_BITDHT) find_package(RapidJSON REQUIRED) target_link_libraries(${PROJECT_NAME} PUBLIC RapidJSON) get_target_property(tmp RapidJSON INTERFACE_INCLUDE_DIRECTORIES) -message(STATUS "rapidjson interface: ${tmp}") ################################################################################ ### SQLite3 / SQLCipher @@ -578,17 +586,7 @@ install( COMPONENT libretroshare EXCLUDE_FROM_ALL LIBRARY DESTINATION "${RS_LIB_INSTALL_DIR}" - PUBLIC_HEADER DESTINATION "${RS_INCLUDE_INSTALL_DIR}" + FILE_SET HEADERS DESTINATION "${RS_INCLUDE_INSTALL_DIR}" ) -## As of today libretroshare doesn't hide implementation details properly so it -## is necessary to install private headers too -foreach(P_HEADER ${RS_IMPLEMENTATION_HEADERS}) - get_filename_component(P_DIR "${P_HEADER}" DIRECTORY) - install( - FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/${P_HEADER}" - DESTINATION "${RS_INCLUDE_INSTALL_DIR}/${P_DIR}" - COMPONENT libretroshare - EXCLUDE_FROM_ALL - ) -endforeach() +## TODO: export targets and create config packages for install and build trees diff --git a/src/jsonapi/CMakeLists.txt b/src/jsonapi/CMakeLists.txt index 645ed866a..53bc5553f 100644 --- a/src/jsonapi/CMakeLists.txt +++ b/src/jsonapi/CMakeLists.txt @@ -55,11 +55,6 @@ target_sources(${PROJECT_NAME} "${CMAKE_CURRENT_BINARY_DIR}/jsonapi-wrappers.inl" ) -target_include_directories(${PROJECT_NAME} - PRIVATE - "${JSONAPI_GENERATOR_OUTPUT_DIR}" -) - find_package(restbed REQUIRED) target_link_libraries(${PROJECT_NAME} PRIVATE restbed::restbed) diff --git a/src/jsonapi/jsonapi-generator-doxygen.conf.in b/src/jsonapi/jsonapi-generator-doxygen.conf.in index 7c17d0192..961437b45 100644 --- a/src/jsonapi/jsonapi-generator-doxygen.conf.in +++ b/src/jsonapi/jsonapi-generator-doxygen.conf.in @@ -67,7 +67,7 @@ HIDE_UNDOC_CLASSES = NO # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = @CMAKE_CURRENT_SOURCE_DIR@/src/ +INPUT = @PROJECT_SOURCE_DIR@/src/ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/src/rsserver/rsinit.cc b/src/rsserver/rsinit.cc index 3cee49ecb..e8f8fcdca 100644 --- a/src/rsserver/rsinit.cc +++ b/src/rsserver/rsinit.cc @@ -302,11 +302,7 @@ bool doPortRestrictions = false; */ const char* RsInit::libRetroShareVersion() { - return - RS_PRIVATE_STRINGIFY(LIBRS_MAJOR_VERSION) "." - RS_PRIVATE_STRINGIFY(LIBRS_MINOR_VERSION) "." - RS_PRIVATE_STRINGIFY(LIBRS_MINI_VERSION) - RS_PRIVATE_STRINGIFY(LIBRS_EXTRA_VERSION); + return RS_PRIVATE_STRINGIFY(LIBRS_FULL_VERSION); } /********