CMakeLists.txt 876 B

1234567891011121314151617181920212223242526272829
  1. cmake_minimum_required(VERSION 3.2)
  2. project(ExternalProjectSubdir NONE)
  3. include(ExternalProject)
  4. # Remove the custom target output to be sure it runs in an
  5. # incremental test. Skip this on VS 6 because it sometimes
  6. # re-runs CMake after the custom command runs.
  7. if(NOT CMAKE_GENERATOR STREQUAL "Visual Studio 6")
  8. file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/PreSubdir1.txt)
  9. endif()
  10. add_custom_target(PreSubdir1
  11. COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/PreSubdir1.txt
  12. )
  13. add_library(PreSubdir1Interface INTERFACE)
  14. add_dependencies(PreSubdir1Interface PreSubdir1)
  15. ExternalProject_Add(Subdir1
  16. SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Subdir1
  17. BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/Subdir1
  18. CMAKE_ARGS -DNORMAL_VAR=NORMAL_VALUE -DGENEX_VAR=$<1:GENEX_VALUE>
  19. LOG_CONFIGURE 1
  20. BUILD_COMMAND ""
  21. INSTALL_COMMAND ""
  22. DEPENDS PreSubdir1Interface
  23. )