1
0

DisableSourceChanges.cmake 758 B

123456789101112131415161718
  1. cmake_policy(SET CMP0168 NEW)
  2. # Undocumented variable used to catch attempts to write to anywhere under the
  3. # source directory that isn't under the build directory. In order for this
  4. # code path to be checked for direct population mode, we need a non-empty
  5. # download, update, or patch command so that the population code path is used.
  6. # Custom commands might not write to the source directory and instead just
  7. # print messages or other non-modifying tasks, like is done here.
  8. set(CMAKE_DISABLE_SOURCE_CHANGES TRUE)
  9. include(FetchContent)
  10. FetchContent_Declare(
  11. WithProject
  12. SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/WithProject # This exists
  13. DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E echo "Download command executed"
  14. )
  15. FetchContent_MakeAvailable(WithProject)