From 29cf15dfbcd1091fd44bcc12ebd659866ac5de91 Mon Sep 17 00:00:00 2001 From: David Horstmann Date: Thu, 8 Dec 2022 12:12:37 +0100 Subject: [PATCH] Improve CMake backward compatibility Use code with clear behavior in CMake 2.8.12 (which we try to support in Mbed TLS 2.28, although that's mostly for the sake of RHEL, not Windows). The code in the previous commit relied on features introduced in CMake 3.x, although it worked as desired by accident because `LIST_DIRECTORIES false` was effectively ignored and `configure_file` on a directory had no harmful effect. Signed-off-by: Gilles Peskine Signed-off-by: David Horstmann --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 755ac271e..72cc737c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,9 +153,11 @@ function(link_to_source base_name) endif() else() if (IS_DIRECTORY ${target}) - file(GLOB_RECURSE files FOLLOW_SYMLINKS LIST_DIRECTORIES false RELATIVE ${target} "${target}/*") + file(GLOB_RECURSE files FOLLOW_SYMLINKS RELATIVE ${target} "${target}/*") foreach(file IN LISTS files) - configure_file("${target}/${file}" "${link}/${file}" COPYONLY) + if(NOT IS_DIRECTORY "${target}/${file}") + configure_file("${target}/${file}" "${link}/${file}" COPYONLY) + endif() endforeach(file) else() configure_file(${target} ${link} COPYONLY)