1
0

CMakeLists.txt 803 B

12345678910111213141516171819202122232425
  1. cmake_minimum_required (VERSION 2.6)
  2. PROJECT(TestWorkingDir)
  3. ADD_CUSTOM_COMMAND(
  4. OUTPUT "${TestWorkingDir_BINARY_DIR}/working.c"
  5. COMMAND "${CMAKE_COMMAND}" -E copy ./working.c.in "${TestWorkingDir_BINARY_DIR}/working.c"
  6. WORKING_DIRECTORY "${TestWorkingDir_SOURCE_DIR}"
  7. COMMENT "custom command"
  8. )
  9. SET_SOURCE_FILES_PROPERTIES(
  10. "${TestWorkingDir_BINARY_DIR}/working.c"
  11. "${TestWorkingDir_BINARY_DIR}/customTarget.c"
  12. PROPERTIES GENERATED 1)
  13. ADD_EXECUTABLE(working "${TestWorkingDir_BINARY_DIR}/working.c"
  14. "${TestWorkingDir_BINARY_DIR}/customTarget.c")
  15. ADD_CUSTOM_TARGET(
  16. Custom ALL
  17. COMMAND "${CMAKE_COMMAND}" -E copy_if_different ./customTarget.c "${TestWorkingDir_BINARY_DIR}/customTarget.c"
  18. WORKING_DIRECTORY "${TestWorkingDir_SOURCE_DIR}"
  19. )
  20. ADD_DEPENDENCIES(working Custom)