Skip to content

Commit d82bc7a

Browse files
remove git submodule for QP/C repo. Use FetchContent instead.
But only if CMS_QPC_TOP_DIR is not defined. This allows a higher level project to avoid having duplicate QP/C code in a project's source code tree.
1 parent 3672c4b commit d82bc7a

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "externals/qpc"]
2-
path = externals/qpc
3-
url = git@github.com:QuantumLeaps/qpc.git

CMakeLists.txt

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
cmake_minimum_required(VERSION 3.16)
22
project(cpputest-for-qpc-lib)
3+
include(FetchContent)
34

45
set(CMAKE_CXX_STANDARD 14)
56
set(CMAKE_C_STANDARD 11)
@@ -8,11 +9,17 @@ add_compile_options(-Wall -Wextra -Werror)
89

910
set(CMS_EXTERNALS_TOP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/externals)
1011
set(CMS_CMAKE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cpputest-for-qpc-lib/cmake)
11-
set(CMS_QPC_TOP_DIR ${CMS_EXTERNALS_TOP_DIR}/qpc)
1212

13-
include(${CMS_CMAKE_DIR}/qpcCMakeSupport.cmake)
14-
15-
# todo: if not set then use externals
16-
set(CMS_QPC_TOP_DIR ${EXTERNALS_TOP_DIR}/qpc)
13+
if(NOT DEFINED CMS_QPC_TOP_DIR)
14+
set(CMS_QPC_TOP_DIR ${CMS_EXTERNALS_TOP_DIR}/qpc)
15+
FetchContent_Declare(qpc
16+
GIT_REPOSITORY https://github.com/QuantumLeaps/qpc.git
17+
GIT_TAG fcea9943bbeeca49c66ce124d4d71467f6e2661e #7.3.3
18+
SOURCE_DIR ${CMS_QPC_TOP_DIR}
19+
)
20+
message("Fetching QP/C git repository")
21+
FetchContent_MakeAvailable(qpc)
22+
endif(NOT DEFINED CMS_QPC_TOP_DIR)
1723

24+
include(${CMS_CMAKE_DIR}/qpcCMakeSupport.cmake)
1825
add_subdirectory(cpputest-for-qpc-lib)

externals/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
qpc/

externals/qpc

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)