From 19ae54906e88d8b869deb57d3cc8d4fde4751d93 Mon Sep 17 00:00:00 2001 From: ipraveenMS Date: Tue, 10 Dec 2024 10:31:58 -0800 Subject: [PATCH 1/2] using COPY_FILE only with cmake 3.19+ where it is introduced --- tests/functests/CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/functests/CMakeLists.txt b/tests/functests/CMakeLists.txt index 99b2c17e3..d0f775142 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.19") + # Use file(COPY_FILE ...) for CMake 3.19 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() From 06683d26c782d1c5dcd43c94662c3b37c677d554 Mon Sep 17 00:00:00 2001 From: ipraveenMS Date: Tue, 10 Dec 2024 11:25:11 -0800 Subject: [PATCH 2/2] Fix the version number of cmake --- tests/functests/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/functests/CMakeLists.txt b/tests/functests/CMakeLists.txt index d0f775142..0a3b280a5 100644 --- a/tests/functests/CMakeLists.txt +++ b/tests/functests/CMakeLists.txt @@ -35,8 +35,8 @@ 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) - if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.19") - # Use file(COPY_FILE ...) for CMake 3.19 and later + 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