Logo
1.4
  • Upgrading to conan 1.0
  • Introduction
  • Install
  • Getting started
  • Using packages
  • Creating packages
  • Uploading packages
  • Developing packages
  • Package apps and devtools
  • Mastering conan
  • Systems and cross building
  • Integrations
  • Howtos
    • How to package header-only libraries
    • How to launch conan install from cmake
    • How to create and reuse packages based on Visual Studio
    • Creating and reusing packages based on Makefiles
    • How to manage the GCC >= 5 ABI
    • Using Visual Studio 2017 - CMake integration
    • How to manage C++ standard
    • How to use docker to create and cross build C and C++ conan packages
    • How to reuse Python code in recipes
    • How to create and share a custom generator with generator packages
    • How to manage shared libraries
    • How to reuse cmake install for package() method
    • How to collaborate on other users’ packages
    • How to link with Apple Frameworks
    • How to collect licenses of dependencies
    • How to capture package version from text or build files
    • How to use Conan as other language package manager
    • How to manage SSL (TLS) certificates
    • How to check the version of the Conan client inside a conanfile
    • Use a generic CI with Conan and Artifactory
  • Reference
  • Videos and links
  • FAQ
  • Changelog
conan

This document is for a "1.X" legacy Conan version, which is no longer recommended. Please update to Conan 2, click here to read the Conan 2 documentation

🔍 Scan for vulnerabilities in your packages with the new conan audit command. Register now.

  • Howtos
  • How to link with Apple Frameworks
  • View page source

How to link with Apple Frameworks

It is common in OSx that your conan package needs to link with a complete Apple framework, and, of course, you want to propagate this information to all projects/libraries that uses your package.

With regular libraries we use self.cpp_info.libs object to append to it all the libraries:

def package_info(self):

    self.cpp_info.libs = ["SDL2"]
    self.cpp_info.libs.append("OpenGL32")

With frameworks we need to declare the “-framework flag” as a linker flag:

def package_info(self):

    self.cpp_info.libs = ["SDL2"]

    self.cpp_info.exelinkflags.append("-framework Carbon")
    self.cpp_info.exelinkflags.append("-framework CoreAudio")
    self.cpp_info.exelinkflags.append("-framework Security")
    self.cpp_info.exelinkflags.append("-framework IOKit")

    self.cpp_info.sharedlinkflags = self.cpp_info.exelinkflags

In the previous example we are using self.cpp_info.exelinkflags. If we are using CMake to consume this package, it will only link those frameworks if we are building an executable and sharedlinkflags will only apply if we are building a shared library.

If we are not using CMake to consume this package sharedlinkflags and exelinkflags are used indistinctly. In the example above we are assigning in the last line sharedlinkflags with exelinkflags, so no matter what the consumer will build, it will indicate to the linker to link with the specified frameworks.

Previous Next

© Copyright 2016-2018, JFrog.

Built with Sphinx using a theme provided by Read the Docs.
Version: 1.4
Versions
2.16
2.15
2.14
2.13
2.12
2.11
2.10
2.9
2.8
2.7
2.6
2.5
2.4
2.3
2.2
2.1
2.0
2

1
1.66
1.65
1.64
1.63
1.62
1.61
1.60
1.59
1.58
1.57
1.56
1.55
1.54
1.53
1.52
1.51
1.50
1.49
1.48
1.47
1.46
1.45
1.44
1.43
1.42
1.41
1.40
1.39
1.38
1.37
1.36
1.35
1.34
1.33
1.32
1.31
1.30
1.29
1.28
1.27
1.26
1.25
1.24
1.23
1.22
1.21
1.20
1.19
1.18
1.17
1.16
1.15
1.14
1.13
1.12
1.11
1.10
1.9
1.8
1.7
1.6
1.5
1.4
1.3
Downloads
PDF