Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix build_folder_vars for editables #13488

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions conan/tools/cmake/layout.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

from conans.client.graph.graph import RECIPE_CONSUMER
from conans.client.graph.graph import RECIPE_CONSUMER, RECIPE_EDITABLE
from conans.errors import ConanException


Expand Down Expand Up @@ -59,7 +59,7 @@ def get_build_folder_custom_vars(conanfile):
"settings.compiler.cppstd", "settings.build_type", "options.shared"]
else:
try:
is_consumer = conanfile._conan_node.recipe == RECIPE_CONSUMER
is_consumer = conanfile._conan_node.recipe in (RECIPE_CONSUMER, RECIPE_EDITABLE)
except AttributeError:
is_consumer = False
if is_consumer:
Expand Down
27 changes: 27 additions & 0 deletions conans/test/integration/toolchains/cmake/test_cmaketoolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,33 @@ def layout(self):
"build/linux/Debug/generators/conan_toolchain.cmake"))


def test_build_folder_vars_editables():
""" when packages are in editable, they must also follow the build_folder_vars
https://github.com/conan-io/conan/issues/13485
"""
c = TestClient()
conanfile = textwrap.dedent("""
from conan import ConanFile
from conan.tools.cmake import cmake_layout

class Conan(ConanFile):
name = "dep"
version = "0.1"
settings = "os", "build_type"
generators = "CMakeToolchain"

def layout(self):
cmake_layout(self)
""")
c.save({"dep/conanfile.py": conanfile,
"app/conanfile.py": GenConanfile().with_requires("dep/0.1")})
c.run("editable add dep")
conf = "tools.cmake.cmake_layout:build_folder_vars='[\"settings.os\", \"settings.build_type\"]'"
settings = " -s os=FreeBSD -s arch=armv8 -s build_type=Debug"
c.run("install app -c={} {}".format(conf, settings))
assert os.path.exists(os.path.join(c.current_folder, "dep", "build", "freebsd-debug"))


def test_set_linker_scripts():
profile = textwrap.dedent(r"""
[settings]
Expand Down