diff --git a/tests/functests/CMakeLists.txt b/tests/functests/CMakeLists.txt index 99b2c17e3..0a3b280a5 100644 --- a/tests/functests/CMakeLists.txt +++ b/tests/functests/CMakeLists.txt @@ -35,7 +35,14 @@ if (EXISTS ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests) ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/ECSConfigCacheFuncTests.cpp ) if (EXISTS ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json) - file(COPY_FILE ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json ${CMAKE_BINARY_DIR}/test.json) + if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.21") + # Use file(COPY_FILE ...) for CMake 3.21 and later + file(COPY_FILE ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json ${CMAKE_BINARY_DIR}/test.json) + else() + # Use file(COPY ...) as an alternative for older versions + file(COPY ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json + DESTINATION ${CMAKE_BINARY_DIR}) + endif() endif() endif()