Commit e0254ed5fe818d87eaa85ed52db19bbc1f827300
1 parent
55a1aed7
adjusted cmakelists to find the subdirectory folder.
Showing
3 changed files
with
33 additions
and
14 deletions
CMakeLists.txt
| 1 | 1 | cmake_minimum_required(VERSION 3.0) |
| 2 | - | |
| 3 | -# Check to see where cmake is located. | |
| 4 | -if( IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cmake ) | |
| 5 | - LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) | |
| 6 | -elseif( IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../cmake ) | |
| 7 | - LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) | |
| 2 | +project(osdev_qt-bluetooth) | |
| 3 | +# ============================================================================== | |
| 4 | +# Check to see if we're a submodule or top-repo. | |
| 5 | +if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/submodules/cmake) | |
| 6 | + message( STATUS "Looks like we're a single module" ) | |
| 7 | + LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/submodules/cmake) | |
| 8 | +elseif(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../submodules/cmake) | |
| 9 | + message( STATUS "Looks like we're a submodule" ) | |
| 10 | + LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../submodules/cmake) | |
| 8 | 11 | else() |
| 9 | - return() | |
| 12 | + message( FATAL_ERROR "No cmake directory found. Did you run the submodules script?" ) | |
| 10 | 13 | endif() |
| 11 | 14 | |
| 15 | +# ============================================================================== | |
| 12 | 16 | # Check to see if there is versioning information available |
| 13 | -if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/osdev_versioning/cmake) | |
| 14 | - LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/osdev_versioning/cmake) | |
| 15 | - include(osdevversion) | |
| 17 | +if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/submodules/versioning) | |
| 18 | + LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/submodules/versioning/cmake) | |
| 19 | +elseif(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../submodules/versioning) | |
| 20 | + LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../submodules/versioning/cmake) | |
| 21 | +else() | |
| 22 | + message( FATAL_ERROR "No ${CURRENT_SOURCE_DIR}/osdev_versioning directory found. Did you run the submodules script?" ) | |
| 16 | 23 | endif() |
| 17 | 24 | |
| 25 | +# ============================================================================== | |
| 26 | + | |
| 27 | + | |
| 18 | 28 | include(projectheader) |
| 19 | 29 | project_header(osdev_qt-bluetooth) |
| 20 | 30 | ... | ... |
scripts/setup_submodules
| ... | ... | @@ -4,6 +4,10 @@ |
| 4 | 4 | # == Setting some environment variables |
| 5 | 5 | # =============================================== |
| 6 | 6 | GIT_URL_SUBS="http://gitlab.osdev.nl/open_source" |
| 7 | +GIT_URL_SUBS_CLOSED="http://gitlab.osdev.nl/closed_source" | |
| 8 | + | |
| 9 | +OPEN_REPOS=("mqtt-cpp" "transqueue" "orm" "network" "jobscheduler" "global" "dbconnector" "logutils" "pugixml" "qt-mqtt" "iputils" "crypter" "qt-bluetooth" "versioning" "cmake") | |
| 10 | + | |
| 7 | 11 | FUNC_RESULT="-1" |
| 8 | 12 | |
| 9 | 13 | # Name : print_usage_exit() |
| ... | ... | @@ -101,8 +105,14 @@ function add_submodules() |
| 101 | 105 | for SUB_MODULE in ${SUB_MODULES} |
| 102 | 106 | do |
| 103 | 107 | echo -e "< ${SUB_MODULE} >" |
| 104 | - git submodule add -f ${GIT_URL_SUBS}/${SUB_MODULE}.git ${SUB_MODULE} | |
| 105 | - git config submodule.${SUB_MODULE}.url ${GIT_URL_SUBS}/${SUB_MODULE}.git | |
| 108 | + if [[ "${OPEN_REPOS[*]}" =~ "${SUB_MODULE}" ]]; | |
| 109 | + then | |
| 110 | + git submodule add -f ${GIT_URL_SUBS}/${SUB_MODULE}.git submodules/${SUB_MODULE} | |
| 111 | + git config submodule.${SUB_MODULE}.url ${GIT_URL_SUBS}/${SUB_MODULE}.git | |
| 112 | + else | |
| 113 | + git submodule add -f ${GIT_URL_SUBS_CLOSED}/${SUB_MODULE}.git submodules/${SUB_MODULE} | |
| 114 | + git config submodule.${SUB_MODULE}.url ${GIT_URL_SUBS_CLOSED}/${SUB_MODULE}.git | |
| 115 | + fi | |
| 106 | 116 | done |
| 107 | 117 | } |
| 108 | 118 | ... | ... |
src/CMakeLists.txt
| ... | ... | @@ -14,7 +14,7 @@ include_directories( SYSTEM |
| 14 | 14 | include(compiler) |
| 15 | 15 | |
| 16 | 16 | include_directories( |
| 17 | - ${CMAKE_CURRENT_SOURCE_DIR}/../logutils | |
| 17 | + ${CMAKE_CURRENT_SOURCE_DIR}/../submodules/logutils/src | |
| 18 | 18 | ) |
| 19 | 19 | |
| 20 | 20 | set(SRC_LIST |
| ... | ... | @@ -42,7 +42,6 @@ include(library) |
| 42 | 42 | add_libraries( |
| 43 | 43 | ${Qt5Core_LIBRARIES} |
| 44 | 44 | ${Qt5Bluetooth_LIBRARIES} |
| 45 | - logutils | |
| 46 | 45 | ) |
| 47 | 46 | |
| 48 | 47 | include(installation) | ... | ... |