CMakeLists.txt 407 B

12345678910111213
  1. if(NOT CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}")
  2. add_custom_command(
  3. OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/hello_world
  4. COMMAND ${CMAKE_COMMAND} -E copy
  5. ${CMAKE_CURRENT_SOURCE_DIR}/hello_world ${CMAKE_CURRENT_BINARY_DIR}
  6. DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/hello_world
  7. )
  8. add_custom_target(
  9. hello_world_copy ALL
  10. DEPENDS #hello_world
  11. ${CMAKE_CURRENT_BINARY_DIR}/hello_world
  12. )
  13. endif()