Skip to content

Commit

Permalink
fix build_folder_vars for editables (#13488)
Browse files Browse the repository at this point in the history
* fix build_folder_vars for editables

* fix
  • Loading branch information
memsharded authored Mar 22, 2023
1 parent bc34240 commit 7fdcf39
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
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

0 comments on commit 7fdcf39

Please sign in to comment.