From 86c922d6cd3c11c8e690c592891475b01c3633d4 Mon Sep 17 00:00:00 2001 From: jmacey Date: Wed, 11 Oct 2023 13:11:15 +0100 Subject: [PATCH] updated the CMakeLists to auto copy files to build folder, seems to work for some IDEs but need to test on windows --- CMakeLists.txt | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6da53765..95173e58 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -304,12 +304,33 @@ if(NOT DEFINED PYNGL_ONLY) target_link_libraries(NGLTests PRIVATE --coverage) endif() # gtest_discover_tests(NGLTests) - add_custom_target(CopyTestfiles ALL - COMMAND ${CMAKE_COMMAND} -E copy_directory - ${CMAKE_SOURCE_DIR}/tests/files - ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/files - COMMENT "Copy Test files to build directory" + # Now create a post build command to copy the test directories + add_custom_command( + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${CMAKE_SOURCE_DIR}/tests/files + ${CMAKE_BINARY_DIR}/files + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT ${CMAKE_BINARY_DIR}/files/ + COMMENT "copying test files" ) + # Now a custom target to copy the files which check to see if the files exist + add_custom_target( + CopyTestfiles ALL + DEPENDS ${CMAKE_BINARY_DIR}/files/ + ) + # now add this a dependency for NGLTests so it gets run. + add_dependencies(NGLTests CopyTestfiles ) + + + + # add_custom_target(CopyTestfiles ALL +# COMMAND ${CMAKE_COMMAND} -E copy_directory +# ${CMAKE_SOURCE_DIR}/tests/files +# ${CMAKE_BINARY_DIR}/files +# COMMENT "Copy Test files to build directory" +# ) + endif() # PYNGL_ONLY # PyNGL