conan icon indicating copy to clipboard operation
conan copied to clipboard

[question] editable mode and layout / cmake_layout

Open davidebenato opened this issue 3 years ago • 0 comments

I have two libraries, library A and library B. Library B depends on library A, and I would like to try to put library A in editable mode.

Library A defines the layout as follows in its conanfile.py

    def layout(self):
        cmake_layout(self)

Because I am using Clion to build, I am actually building libraryA inside the following directory:

~/libraryA/cmake-build-debug

If I am not in editable mode, and I build library B and I install it to local cache, libraryB is able to pick up correctly library A. However when I place library A in editable mode, library B seems to be unable to find it. After doing a conan install in library B I can see that in the following file:

generators/libraryA-debug-x86_64-data.cmake I have a variable missing, which I think it's where the problem comes from.

set(libraryA_PACKAGE_FOLDER_DEBUG "")
set(platform-cpp_INCLUDE_DIRS_DEBUG "/root/libraryA/./include")

My question is:

How can I configure the correct libraryA_PACKAGE_FOLDER_DEBUG in order for editable mode to work properly? Do I need to change the layout in libraryA's conanfile.py, or can I pass it somehow to theconan install command when preparing libraryB?

I am using conan 1.50.0

I also tried passing a layout file to the conan editable add command, following this page:https://docs.conan.io/en/latest/reference/config_files/editable_layout.html

To test I am using a very simple layout.ini file

[libdirs]
cmake-build-debug

I add it to the editable list as:

conan editable add --layout layout.ini . libraryA/1.0.0@master

After rerunning conan install in libraryB, I still have:

set(libraryA_LIB_DIRS_DEBUG "/root/libraryA/build/Debug/.")

while I would expect to see:

set(libraryA_LIB_DIRS_DEBUG "/root/libraryA/cmake-build-debug.")

I must be doing something wrong. Could you help me trying to understand what I misunderstood and how can I make the two libraries work well in editable mode?

davidebenato avatar Aug 10 '22 12:08 davidebenato