blob: c1c5607af7818c7a3e8db26c50779a281678c9f3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
set(policyCommand "cmake_policy(SET CMP0150 NEW)")
# Need to keep paths and file names short to avoid hitting limits on Windows.
# Directory names "a" through to "g" are used here according to the following:
# a = Top project
# b/c = Middle project
# d = Bottom project
# e/f = Cloned Top project
# g = Build directory for cloned Top project
#
# Dependency names map as follows:
# X = middle dependency
# Y = bottom dependency
set(projName top)
set(depName X)
set(epRelativeGitRepo ../b/c)
set(fcRelativeGitRepo ../b/c)
configure_file(CMakeLists.txt.in a/CMakeLists.txt @ONLY)
initGitRepo("${CMAKE_CURRENT_BINARY_DIR}/a")
set(projName middle)
set(depName Y)
set(epRelativeGitRepo ../../d)
set(fcRelativeGitRepo ../../d)
configure_file(CMakeLists.txt.in b/c/CMakeLists.txt @ONLY)
initGitRepo("${CMAKE_CURRENT_BINARY_DIR}/b/c")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/d")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/d/CMakeLists.txt" [[
cmake_minimum_required(VERSION 3.26)
project(bottom LANGUAGES NONE)
message(STATUS "Configured bottom project")
]])
initGitRepo("${CMAKE_CURRENT_BINARY_DIR}/d")
set(clonedTopDir "${CMAKE_CURRENT_BINARY_DIR}/e/f")
file(MAKE_DIRECTORY "${clonedTopDir}")
execGitCommand(${CMAKE_CURRENT_BINARY_DIR} clone --quiet "file://${CMAKE_CURRENT_BINARY_DIR}/a" "${clonedTopDir}")
add_subdirectory("${clonedTopDir}" "${CMAKE_CURRENT_BINARY_DIR}/g")
# Ensure build order is predictable
add_custom_target(non-ep-top ALL COMMAND ${CMAKE_COMMAND} -E echo "Non-ep top project")
add_dependencies(non-ep-top ep-X)
add_dependencies(ep-X ep-Y)
|