DirOverridesDisconnected.cmake 656 B

123456789101112131415161718
  1. include(FetchContent)
  2. # Test using saved details. We are re-using a SOURCE_DIR from a previous test
  3. # so the download command should not be executed.
  4. FetchContent_Declare(
  5. t1
  6. SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/savedSrc
  7. BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/savedBin
  8. DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E false
  9. )
  10. FetchContent_Populate(t1)
  11. if(NOT "${t1_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/savedSrc")
  12. message(FATAL_ERROR "Wrong SOURCE_DIR returned: ${t1_SOURCE_DIR}")
  13. endif()
  14. if(NOT "${t1_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/savedBin")
  15. message(FATAL_ERROR "Wrong BINARY_DIR returned: ${t1_BINARY_DIR}")
  16. endif()