CLion: trying to use files from container in output directory
Hi,
I am using the Docker toolchain in CLion. I have a docker image in which I build files needed for my project in a folder /build.
This is the end of my Docker file:
WORKDIR /build
# VOLUME /build
RUN conan install /AppManager/ -pr ubuntu-gcc-9-Debug \
&& chown -R $USERNAME:$USERNAME /build && chmod 755 /build
I have mapped the output directory in my CLion project to the /build directory in the container, i.e. /home/jacob/AppManager/cmake-build-unittests → /build under Volume bindings in the toolchain settings. This because in my cmake file I have a line like this:
include( "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake" )
I was hoping that CLion will have access to the files from the Docker image. However, the build directory is created with root permission even though I have explicitly changed the ownership of the /build directory to user jacob in the Docker image (see above), and it doesn't build.
I manually changed ownership of the output directory from my host and tried building, but the files I expect to be there from the /build folder in the container aren't there.
I get this error:
CMake Error at unittests.cmake:6 (include):
include could not find requested file:
/build/conanbuildinfo.cmake
Call Stack (most recent call first):
CMakeLists.txt:251 (include)
Is there any way I can do this? Would I have to do a pre-build step?
Please sign in to leave a comment.
What seems to happens is that when the container is created by CLion the output directory /build is cleared. So all the container contents in that directory go away.
If I change the output directory to cmake-debug-unittests and the CMakeLists.txt as follows:
it works. I wonder if there is any way round this without having to change my CMakeLists.txt file?