Skip to content

Commit 8c2cdb6

Browse files
update cavl population
1 parent d55e1b4 commit 8c2cdb6

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

cmake/modules/Findcavl.cmake

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,39 @@
55
#
66

77
include(FetchContent)
8-
98
set(cavl_GIT_REPOSITORY "https://github.com/pavel-kirienko/cavl")
109
set(cavl_GIT_TAG "c-2.1.0")
1110

1211
FetchContent_Declare(
1312
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}
1615
)
17-
FetchContent_GetProperties(cavl)
18-
if (NOT cavl_POPULATED)
19-
FetchContent_Populate(cavl)
20-
endif ()
2116

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()
2240

23-
#add_library(cavl2_c INTERFACE)
24-
#target_include_directories(cavl2_c INTERFACE "${cavl_SOURCE_DIR}/c")
2541
add_project_library(
2642
NAME cavl2_c
2743
HEADER_PATH "${cavl_SOURCE_DIR}/c"

0 commit comments

Comments
 (0)