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

explaining cmake targets #408

Merged
merged 2 commits into from
Dec 13, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion mastering/build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ There are two ways to invoke your cmake tools:

def build(self):
cmake = CMake(self)
cmake.configure(source_dir=self.source_folder, build_dir="./")
cmake.configure()
cmake.build()


Expand Down
2 changes: 1 addition & 1 deletion packaging/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Let`s have a look to the root package recipe ``conanfile.py``:

def build(self):
cmake = CMake(self)
cmake.configure(source_dir="%s/hello" % self.source_folder)
cmake.configure(source_dir="hello")
cmake.build()

# Explicit way:
Expand Down
2 changes: 1 addition & 1 deletion packaging/package_repo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Now lets have a look to the ``conanfile.py``:

def build(self):
cmake = CMake(self)
cmake.configure(source_dir="%s/src" % self.source_folder)
cmake.configure(source_dir="src")
cmake.build()

# Explicit way:
Expand Down
2 changes: 1 addition & 1 deletion reference/commands/creator/export-pkg.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ And such package will contain just the files:

def build(self):
cmake = CMake(self)
cmake.configure(source_dir="%s/hello" % self.source_folder)
cmake.configure(source_dir="hello")
cmake.build()

def package(self):
Expand Down
2 changes: 1 addition & 1 deletion reference/commands/development/build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ specified.

def build(self):
cmake = CMake(self)
cmake.configure(source_dir="%s/hello" % self.source_folder)
cmake.configure(source_dir="hello")
cmake.build()


Expand Down
18 changes: 18 additions & 0 deletions reference/generators/cmake.rst
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,21 @@ There are other methods automatically called by ``conan_basic_setup()`` but you
| conan_set_find_paths() | Adjust CMAKE_MODULE_PATH and CMAKE_PREFIX_PATH |
+--------------------------------+----------------------------------------------------------------------+

Targets generated by conanbuildinfo.cmake
-----------------------------------------

If you use ``conan_basic_setup(TARGETS)``, then some cmake targets will be generated (this only works for CMake>3)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Highlight cmake code like: CONAN_PKG::PkgName, CONAN_LIB::PkgName_LibName


These targets are:

- A CONAN_PKG::PkgName target per package in the dependency graph. This is an IMPORTED INTERFACE target. IMPORTED
because it is external, a pre-compiled library. INTERFACE, because it doesn't necessarily match a library,
it could be a header-only library, or the package could even contain several libraries. It contains all the
properties (include paths, compile flags, etc) that are defined in the ``package_info()`` method of the package.
- Inside each package a CONAN_LIB::PkgName_LibName target will be generated for each library. Its type is IMPORTED
UNKNOWN, its mainly purpose is to provide a correct link order. Their only properties are the location and the
dependencies
- A CONAN_PKG depends on every CONAN_LIB that belongs to it, and to its direct public dependencies (i.e. other CONAN_PKG
targets from its ``requires``)
- Each CONAN_LIB depends on the direct public dependencies CONAN_PKG targets of its container package. This guarantees
correct link order.