summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAndreas Hartmetz <andreas@ixgreen.de>2021-05-14 14:48:19 +0200
committerAndreas Hartmetz <ahartmetz@gmail.com>2021-05-18 13:51:06 +0000
commit27d9c0542cb289098014df534e1672743fc44007 (patch)
treeddf026827affa19cb1748621335e527a37133ef0 /CMakeLists.txt
parent861647e8a5e9985db9da2943e422af4e91de2710 (diff)
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 <alexandru.croitor@qt.io>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt11
1 files changed, 9 insertions, 2 deletions
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 <build_dir>) before invoking cmake <source_dir>.")
endif()
unset(build_dir_absolute)
unset(build_dir_realpath)