From 39a9e98f2c9ae50d1063c3544a84d725342e8774 Mon Sep 17 00:00:00 2001 From: Steven de Ridder Date: Mon, 31 Jan 2022 13:04:28 +0100 Subject: [PATCH] adjusted cmakelists to find the subdirectory folder. --- CMakeLists.txt | 28 +++++++++++++++++++--------- scripts/setup_submodules | 4 ++-- src/CMakeLists.txt | 9 ++++----- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index da7537c..70a07f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,20 +1,30 @@ cmake_minimum_required(VERSION 3.0) +project(transqueue) -# 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) +# ============================================================================== +# 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_transqueue) diff --git a/scripts/setup_submodules b/scripts/setup_submodules index 7b5e7d8..5c19076 100755 --- a/scripts/setup_submodules +++ b/scripts/setup_submodules @@ -107,10 +107,10 @@ function add_submodules() echo -e "< ${SUB_MODULE} >" if [[ "${OPEN_REPOS[*]}" =~ "${SUB_MODULE}" ]]; then - git submodule add -f ${GIT_URL_SUBS}/${SUB_MODULE}.git ${SUB_MODULE} + 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 ${SUB_MODULE} + 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 4ccb86d..dc8385e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,4 @@ cmake_minimum_required(VERSION 3.0) -LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake) include(projectheader) project_header(transqueue) @@ -8,10 +7,10 @@ find_package( Qt5Sql REQUIRED ) include_directories( SYSTEM ${Qt5Core_INCLUDE_DIRS} - ${CMAKE_CURRENT_SOURCE_DIR}/../datatypes - ${CMAKE_CURRENT_SOURCE_DIR}/../logutils - ${CMAKE_CURRENT_SOURCE_DIR}/../config - ${CMAKE_CURRENT_SOURCE_DIR}/../pugixml + ${CMAKE_CURRENT_SOURCE_DIR}/../submodules/datatypes/src + ${CMAKE_CURRENT_SOURCE_DIR}/../submodules/logutils/src + ${CMAKE_CURRENT_SOURCE_DIR}/../submodules/config/src + ${CMAKE_CURRENT_SOURCE_DIR}/../submodules/pugixml/src ) include(compiler) -- libgit2 0.21.4