summaryrefslogtreecommitdiff
path: root/Tests/RunCMake/FetchContent/SameGenerator.cmake
blob: 58204ef041b5b8a69cffef8408f0dbe2631ad8a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
include(FetchContent)

FetchContent_Declare(
  t1
  DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E echo "Download command executed"
)

FetchContent_Populate(t1)

file(STRINGS "${FETCHCONTENT_BASE_DIR}/t1-subbuild/CMakeCache.txt"
     matchLine REGEX "^CMAKE_GENERATOR:.*="
     LIMIT_COUNT 1
)
if(NOT matchLine MATCHES "${CMAKE_GENERATOR}")
  message(FATAL_ERROR "Generator line mismatch: ${matchLine}\n"
                      "  Expected type: ${CMAKE_GENERATOR}")
endif()