From 27d9c0542cb289098014df534e1672743fc44007 Mon Sep 17 00:00:00 2001 From: Andreas Hartmetz Date: Fri, 14 May 2021 14:48:19 +0200 Subject: Be more helpful about the symlinked build directory problem - Explain why a symlinked build dir won't work - Add another workaround suggestion that works well in my case Change-Id: I3f7eaeac2974e037587941f6f761fbcb262c4631 Reviewed-by: Alexandru Croitor --- CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 45110a429b..5530d7efa8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,12 +8,19 @@ cmake_minimum_required(VERSION 3.16) # Get the repo version and CMake policy details include(.cmake.conf) -# Bail out if parts of the build directory's components are symlinks. +# Bail out if any part of the build directory's path is symlinked. +# The OS-level current working directory is always the real path and some +# parts of the build system only deal with that path, which causes confusion +# when compared to the logical working directory maintained by the shell and +# passed on the command line. get_filename_component(build_dir_absolute "${CMAKE_BINARY_DIR}" ABSOLUTE) get_filename_component(build_dir_realpath "${CMAKE_BINARY_DIR}" REALPATH) if(NOT build_dir_absolute STREQUAL build_dir_realpath) message(FATAL_ERROR "The build path \"${CMAKE_BINARY_DIR}\" contains symlinks. \ -This is not supported. Please use some other - transparent - mechanism to map directories.") +This is not supported. Possible solutions: +- map directories using a transparent mechanism such as mount --bind +- pass the real path of the build directory to CMake, e.g. using \ +cd $(realpath ) before invoking cmake .") endif() unset(build_dir_absolute) unset(build_dir_realpath) -- cgit v1.2.3