From 81aff327f01b0c62fbb33666ecc9cb204255f718 Mon Sep 17 00:00:00 2001 From: Samer W Ali <108325733+ali-samer@users.noreply.github.com> Date: Sun, 8 Jun 2025 12:42:32 -0600 Subject: [PATCH] Update PreventInSourceBuilds.cmake MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace get_filename_component with file(REAL_PATH) for symlink resolution "file" command offers a more modern approach to resolving symlinks. Introduced in CMake ≥ 3.19 --- cmake/PreventInSourceBuilds.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/PreventInSourceBuilds.cmake b/cmake/PreventInSourceBuilds.cmake index 302a0bae..b7769ada 100644 --- a/cmake/PreventInSourceBuilds.cmake +++ b/cmake/PreventInSourceBuilds.cmake @@ -3,8 +3,8 @@ # function(myproject_assure_out_of_source_builds) # make sure the user doesn't play dirty with symlinks - get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH) - get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH) + file(REAL_PATH "${CMAKE_SOURCE_DIR}" srcdir) + file(REAL_PATH "${CMAKE_BINARY_DIR}" bindir) # disallow in-source builds if("${srcdir}" STREQUAL "${bindir}")