DirOverridesDisconnected.cmake 687 B

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