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 cmakedeps systemlibs visibility #13364

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
5 changes: 3 additions & 2 deletions conan/tools/cmake/cmakedeps/templates/target_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,9 @@ def join_defines(values, prefix=""):
# self.lib_paths = "" IMPORTANT! LINKERS IN LINUX FOR SHARED MIGHT NEED IT EVEN IF
# NOT REALLY LINKING LIB
self.libs = ""
self.system_libs = ""
self.frameworks = ""
if cpp_info.frameworkdirs: # Only invalidate for in-package frameworks
# FIXME: The mix of in-package frameworks + system ones is broken
self.frameworks = ""
if require and not require.libs and not require.headers:
self.defines = ""
self.compile_definitions = ""
Expand Down
1 change: 0 additions & 1 deletion conan/tools/microsoft/msbuilddeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ def join_paths(paths):
if require and not require.libs:
lib_dirs = ""
libs = ""
system_libs = ""
if require and not require.libs and not require.headers:
definitions = ""
compiler_flags = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -503,3 +503,49 @@ def generate(self):
c.run("create . -pr:b=profile_build")
# it doesn't crash anymore, it used to crash
assert "pkg/0.1: Created package" in c.out


def test_system_libs_transitivity():
"""
https://github.com/conan-io/conan/issues/13358
"""
c = TestClient()
system = textwrap.dedent("""\
from conan import ConanFile
class Pkg(ConanFile):
name = "dep"
version = "system"
def package_info(self):
self.cpp_info.system_libs = ["m"]
self.cpp_info.frameworks = ["CoreFoundation"]
""")
header = textwrap.dedent("""
from conan import ConanFile
class Header(ConanFile):
name = "header"
version = "0.1"
package_type = "header-library"
requires = "dep/system"
def package_info(self):
self.cpp_info.system_libs = ["dl"]
self.cpp_info.frameworks = ["CoreDriver"]
""")
app = textwrap.dedent("""\
from conan import ConanFile
class App(ConanFile):
requires = "header/0.1"
settings = "build_type"
generators = "CMakeDeps"
""")
c.save({"dep/conanfile.py": system,
"header/conanfile.py": header,
"app/conanfile.py": app})
c.run("create dep")
c.run("create header")
c.run("install app")
dep = c.load("app/dep-release-data.cmake")
assert "set(dep_SYSTEM_LIBS_RELEASE m)" in dep
assert "set(dep_FRAMEWORKS_RELEASE CoreFoundation)" in dep
app = c.load("app/header-release-data.cmake")
assert "set(header_SYSTEM_LIBS_RELEASE dl)" in app
assert "set(header_FRAMEWORKS_RELEASE CoreDriver)" in app