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

Feature/markdown cmake gen info #7690

Merged
Merged
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
47 changes: 6 additions & 41 deletions conans/client/generators/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@

generator_cmake_find_package_tpl = textwrap.dedent("""
### Generator ``cmake_find_package``
Generates the file Find{{ cpp_info.get_filename("cmake_find_package") }}.cmake
uilianries marked this conversation as resolved.
Show resolved Hide resolved

Add these lines to your *CMakeLists.txt*:

Add these lines to your *CMakeLists.txt*
```cmake
find_package({{ cpp_info.get_filename("cmake_find_package") }})

Expand Down Expand Up @@ -137,45 +138,9 @@
line argument ``--generator/-g`` in the ``conan install`` command.


### Generator ``cmake``

Add these lines to your *CMakeLists.txt*

```cmake
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

target_link_libraries(<library_name> CONAN_PKG::{{ cpp_info.get_name("cmake") }})
```


### Generator ``cmake_find_package``
{% set cmake_find_package_filename = cpp_info.get_filename("cmake_find_package") %}
{% set cmake_find_package_name = cpp_info.get_name("cmake_find_package") %}

Generates the file Find{{ cmake_find_package_filename }}.cmake

Add these lines to your *CMakeLists.txt*

```cmake
find_package({{ cmake_find_package_filename }})

target_link_libraries(<library_name> {{ cmake_find_package_name }}::{{ cmake_find_package_name }})
```

If you are using the
[CMake build helper](https://docs.conan.io/en/latest/reference/build_helpers/cmake.html) then
you need to use the ``cmake`` generator too to adjust the value of CMake variables based on the
value of Conan ones:

```cmake
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

find_package({{ cmake_find_package_name }})

target_link_libraries(<library_name> {{ cmake_find_package_name }}::{{ cmake_find_package_name }})
```
{% include 'generator_cmake' %}
{% include 'generator_cmake_find_package' %}
{% include 'generator_pkg_config_tpl' %}

---
## Header files
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.