|
5 | 5 | # |
6 | 6 |
|
7 | 7 | include(FetchContent) |
8 | | - |
9 | 8 | set(cavl_GIT_REPOSITORY "https://github.com/pavel-kirienko/cavl") |
10 | 9 | set(cavl_GIT_TAG "c-2.1.0") |
11 | 10 |
|
12 | 11 | FetchContent_Declare( |
13 | 12 | cavl |
14 | | - GIT_REPOSITORY ${cavl_GIT_REPOSITORY} |
15 | | - GIT_TAG ${cavl_GIT_TAG} |
| 13 | + GIT_REPOSITORY ${cavl_GIT_REPOSITORY} |
| 14 | + GIT_TAG ${cavl_GIT_TAG} |
16 | 15 | ) |
17 | | -FetchContent_GetProperties(cavl) |
18 | | -if (NOT cavl_POPULATED) |
19 | | - FetchContent_Populate(cavl) |
20 | | -endif () |
21 | 16 |
|
| 17 | +# +--------------------------------------------------------------------------------------------------------------------+ |
| 18 | +# Because we use FetchContent_Populate to specify a source directory other than the default we have |
| 19 | +# to manually manage the <lowercaseName>_POPULATED, <lowercaseName>_SOURCE_DIR, and <lowercaseName>_BINARY_DIR |
| 20 | +# variables normally set by this method. |
| 21 | +# See https://cmake.org/cmake/help/latest/module/FetchContent.html?highlight=fetchcontent#command:fetchcontent_populate |
| 22 | +# for more information. |
| 23 | +# This is not ideal, to copy-and-paste this code, but it is the only way to redirect fetch content to an in-source |
| 24 | +# directory. An upstream patch to cmake is needed to fix this. |
| 25 | +get_property(cavl_POPULATED GLOBAL PROPERTY cavl_POPULATED) |
| 26 | +if(NOT cavl_POPULATED) |
| 27 | + cmake_path(APPEND CETLVAST_EXTERNAL_ROOT "cavl" OUTPUT_VARIABLE LOCAL_cavl_SOURCE_DIR) |
| 28 | + if (NOT ${FETCHCONTENT_FULLY_DISCONNECTED}) |
| 29 | + FetchContent_Populate( |
| 30 | + cavl |
| 31 | + SOURCE_DIR ${LOCAL_cavl_SOURCE_DIR} |
| 32 | + GIT_REPOSITORY ${cavl_GIT_REPOSITORY} |
| 33 | + GIT_TAG ${cavl_GIT_TAG} |
| 34 | + ) |
| 35 | + else() |
| 36 | + set(cavl_SOURCE_DIR ${LOCAL_cavl_SOURCE_DIR}) |
| 37 | + endif() |
| 38 | + set_property(GLOBAL PROPERTY cavl_POPULATED true) |
| 39 | +endif() |
22 | 40 |
|
23 | | -#add_library(cavl2_c INTERFACE) |
24 | | -#target_include_directories(cavl2_c INTERFACE "${cavl_SOURCE_DIR}/c") |
25 | 41 | add_project_library( |
26 | 42 | NAME cavl2_c |
27 | 43 | HEADER_PATH "${cavl_SOURCE_DIR}/c" |
|
0 commit comments