From e0254ed5fe818d87eaa85ed52db19bbc1f827300 Mon Sep 17 00:00:00 2001 From: Steven de Ridder Date: Mon, 31 Jan 2022 14:58:13 +0100 Subject: [PATCH] adjusted cmakelists to find the subdirectory folder. --- CMakeLists.txt | 30 ++++++++++++++++++++---------- scripts/setup_submodules | 14 ++++++++++++-- src/CMakeLists.txt | 3 +-- 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0650364..95da9fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,20 +1,30 @@ cmake_minimum_required(VERSION 3.0) - -# Check to see where cmake is located. -if( IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cmake ) - LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) -elseif( IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../cmake ) - LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) +project(osdev_qt-bluetooth) +# ============================================================================== +# Check to see if we're a submodule or top-repo. +if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/submodules/cmake) + message( STATUS "Looks like we're a single module" ) + LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/submodules/cmake) +elseif(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../submodules/cmake) + message( STATUS "Looks like we're a submodule" ) + LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../submodules/cmake) else() - return() + message( FATAL_ERROR "No cmake directory found. Did you run the submodules script?" ) endif() +# ============================================================================== # Check to see if there is versioning information available -if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/osdev_versioning/cmake) - LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/osdev_versioning/cmake) - include(osdevversion) +if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/submodules/versioning) + LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/submodules/versioning/cmake) +elseif(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../submodules/versioning) + LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../submodules/versioning/cmake) +else() + message( FATAL_ERROR "No ${CURRENT_SOURCE_DIR}/osdev_versioning directory found. Did you run the submodules script?" ) endif() +# ============================================================================== + + include(projectheader) project_header(osdev_qt-bluetooth) diff --git a/scripts/setup_submodules b/scripts/setup_submodules index b8c7a6e..5c19076 100755 --- a/scripts/setup_submodules +++ b/scripts/setup_submodules @@ -4,6 +4,10 @@ # == Setting some environment variables # =============================================== GIT_URL_SUBS="http://gitlab.osdev.nl/open_source" +GIT_URL_SUBS_CLOSED="http://gitlab.osdev.nl/closed_source" + +OPEN_REPOS=("mqtt-cpp" "transqueue" "orm" "network" "jobscheduler" "global" "dbconnector" "logutils" "pugixml" "qt-mqtt" "iputils" "crypter" "qt-bluetooth" "versioning" "cmake") + FUNC_RESULT="-1" # Name : print_usage_exit() @@ -101,8 +105,14 @@ function add_submodules() for SUB_MODULE in ${SUB_MODULES} do echo -e "< ${SUB_MODULE} >" - git submodule add -f ${GIT_URL_SUBS}/${SUB_MODULE}.git ${SUB_MODULE} - git config submodule.${SUB_MODULE}.url ${GIT_URL_SUBS}/${SUB_MODULE}.git + if [[ "${OPEN_REPOS[*]}" =~ "${SUB_MODULE}" ]]; + then + git submodule add -f ${GIT_URL_SUBS}/${SUB_MODULE}.git submodules/${SUB_MODULE} + git config submodule.${SUB_MODULE}.url ${GIT_URL_SUBS}/${SUB_MODULE}.git + else + git submodule add -f ${GIT_URL_SUBS_CLOSED}/${SUB_MODULE}.git submodules/${SUB_MODULE} + git config submodule.${SUB_MODULE}.url ${GIT_URL_SUBS_CLOSED}/${SUB_MODULE}.git + fi done } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 64d0b8b..93d2269 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,7 +14,7 @@ include_directories( SYSTEM include(compiler) include_directories( - ${CMAKE_CURRENT_SOURCE_DIR}/../logutils + ${CMAKE_CURRENT_SOURCE_DIR}/../submodules/logutils/src ) set(SRC_LIST @@ -42,7 +42,6 @@ include(library) add_libraries( ${Qt5Core_LIBRARIES} ${Qt5Bluetooth_LIBRARIES} - logutils ) include(installation) -- libgit2 0.21.4