Skip to content

Commit 81aff32

Browse files
authored
Update PreventInSourceBuilds.cmake
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
1 parent 1015c6b commit 81aff32

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

cmake/PreventInSourceBuilds.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#
44
function(myproject_assure_out_of_source_builds)
55
# make sure the user doesn't play dirty with symlinks
6-
get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
7-
get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH)
6+
file(REAL_PATH "${CMAKE_SOURCE_DIR}" srcdir)
7+
file(REAL_PATH "${CMAKE_BINARY_DIR}" bindir)
88

99
# disallow in-source builds
1010
if("${srcdir}" STREQUAL "${bindir}")

0 commit comments

Comments
 (0)