add_subdirectory and symlink directory
Hi,
I am using the latest version of CLion (2022.3.2) on Ubuntu but running into problems with add_subdirectory in my cmake file. I am also using the Docker toolchain. So the source exists on my host machine, but libraries, toolchain.cmake file exist in the container.
add_subdirectory( External/Logging )
add_subdirectory( External/Tracing )
Both of these subdirectories are symlinks to directories above the project. I keep getting these errors
CMake Error at appsservice.cmake:86 (add_subdirectory):
add_subdirectory given source "External/Logging" which is not an existing
directory.
Call Stack (most recent call first):
CMakeLists.txt:235 (include)
CMake Error at appsservice.cmake:87 (add_subdirectory):
add_subdirectory given source "External/Tracing" which is not an existing
directory.
Call Stack (most recent call first):
CMakeLists.txt:235 (include)
I didn't have this problem before in an older version of CLion. Plus I wasn't using the Docker toolchain.
Any way round this?
Please sign in to leave a comment.
Hello!
By default CLion mounts only the project folder into the container. And also there is an issue with symlinks in case of the Docker toolchain - https://youtrack.jetbrains.com/issue/CPP-30306. I think that these two things lead to the fact that the subdirectories do not really exist in the container.
You can try to specify volume bindings for the actual directories (located above the project) in the Container Settings, see point 3 here https://www.jetbrains.com/help/clion/clion-toolchains-in-docker.html#create-docker-toolchain.
And feel free to comment or upvote the mentioned issue. See https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications if you are not familiar with YouTrack.