Skip to content

Commit

Permalink
Consider _global_defines in XcodeToolchain _check_if_extra_flags (#16429
Browse files Browse the repository at this point in the history
)

* add test

* fix _check_if_extra_flags
  • Loading branch information
czoido authored Jun 10, 2024
1 parent ba42044 commit ad97c32
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion conan/tools/apple/xcodetoolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def _agreggated_xconfig_filename(self):

@property
def _check_if_extra_flags(self):
return self._global_cflags or self._global_cxxflags or self._global_ldflags
return self._global_cflags or self._global_cxxflags or self._global_ldflags or self._global_defines

@property
def _flags_xcconfig_content(self):
Expand Down
11 changes: 11 additions & 0 deletions test/integration/toolchains/apple/test_xcodetoolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,14 @@ def test_toolchain_flags():
assert "OTHER_LDFLAGS = $(inherited) flag3 flag4" in conan_global_flags
conan_global_file = client.load("conan_config.xcconfig")
assert '#include "conan_global_flags.xcconfig"' in conan_global_file


def test_flags_generated_if_only_defines():
# https://github.com/conan-io/conan/issues/16422
client = TestClient()
client.save({"conanfile.txt": "[generators]\nXcodeToolchain\n"})
client.run("install . -c 'tools.build:defines=[\"MYDEFINITION\"]'")
conan_global_flags = client.load("conan_global_flags.xcconfig")
assert "GCC_PREPROCESSOR_DEFINITIONS = $(inherited) MYDEFINITION" in conan_global_flags
conan_global_file = client.load("conan_config.xcconfig")
assert '#include "conan_global_flags.xcconfig"' in conan_global_file

0 comments on commit ad97c32

Please sign in to comment.