Warn about CMake <3.27 for Windows-targeted builds (#1989)

We only use `$<INSTALL_PREFIX>`` when cross-compiling for MinGW on Linux,
so the relevant block is now wrapped in `if(WIN32)`
so a user can more easily lower the `cmake_minimum_required` version.
This commit is contained in:
Rangi
2026-06-24 17:53:11 -04:00
committed by GitHub
parent fc7d9ad573
commit caf561457d
+6
View File
@@ -118,6 +118,11 @@ add_custom_command(TARGET rgbgfx POST_BUILD COMMENT "Copying rgbgfx's DLLs"
COMMAND ${CMAKE_COMMAND} -E copy -t $<TARGET_FILE_DIR:rgbgfx> $<TARGET_RUNTIME_DLLS:rgbgfx>
COMMAND_EXPAND_LISTS VERBATIM)
if(WIN32)
# CMake 3.27 is required for `$<INSTALL_PREFIX>`, but is only needed when cross-compiling for MinGW.
if(CMAKE_VERSION VERSION_LESS "3.27")
message(WARNING "CMake 3.27 or higher is required for `\$<INSTALL_PREFIX>` inside `install(CODE)`")
endif()
# On Windows, you don't link against DLLs directly, but against an import library for that DLL.
# This leads to, sometimes, the DLL being stored in a directory far away from the import library itself!
set(DLL_SEARCH_DIRS CACHE PATH "List of directories in which DLLs will be searched")
@@ -147,3 +152,4 @@ file(GET_RUNTIME_DEPENDENCIES
FOLLOW_SYMLINK_CHAIN)
endforeach()"
COMPONENT shared-libs EXCLUDE_FROM_ALL) # Most platforms install those separately.
endif()