From f46dbfdfcc31f0a9ca6bceb795872c092e77d684 Mon Sep 17 00:00:00 2001 From: Bruno Van de Velde Date: Sun, 22 Dec 2024 14:14:37 +0100 Subject: [PATCH] Fixed warnings in CI related to copying freetype dll on Windows --- CMakeLists.txt | 2 +- cmake/Macros.cmake | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fe94a0625..022ac432c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ # If the cmake version is higher than the minimum version then enable all new policies, up to the maximum version specified. # When cmake is newer than the highest version then its newest policies will still be set to the old behavior for compatibility. -cmake_minimum_required(VERSION 3.16...3.29) +cmake_minimum_required(VERSION 3.16...3.31) # Include macros such as tgui_set_option include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Macros.cmake) diff --git a/cmake/Macros.cmake b/cmake/Macros.cmake index b08880dce..0cefd5005 100644 --- a/cmake/Macros.cmake +++ b/cmake/Macros.cmake @@ -129,8 +129,16 @@ function(copy_dlls_to_exe post_build_destination install_destination target) list(APPEND files_to_copy "$") endif() - # Copy the FreeType dll if needed and when we know where it is + # Copy the FreeType dll if needed and if we know where it is if(TGUI_HAS_FONT_BACKEND_FREETYPE AND FREETYPE_WINDOWS_BINARIES_PATH AND NOT TGUI_USE_STATIC_STD_LIBS) + # Turn backslashes into slashes on Windows, because the install() command can fail if the + # FREETYPE_WINDOWS_BINARIES_PATH variable was initialized with an environment variable that contains backslashes. + if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.20) + cmake_path(SET FREETYPE_WINDOWS_BINARIES_PATH "${FREETYPE_WINDOWS_BINARIES_PATH}") + else() + file(TO_CMAKE_PATH "${FREETYPE_WINDOWS_BINARIES_PATH}" FREETYPE_WINDOWS_BINARIES_PATH) + endif() + if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(freetype_dll "${FREETYPE_WINDOWS_BINARIES_PATH}/release dll/win64/freetype.dll") else()