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

[bug] cmake_lib template adds find_package to all requirements in test_package #16450

Closed
perseoGI opened this issue Jun 10, 2024 · 1 comment · Fixed by #16451
Closed

[bug] cmake_lib template adds find_package to all requirements in test_package #16450

perseoGI opened this issue Jun 10, 2024 · 1 comment · Fixed by #16451

Comments

@perseoGI
Copy link
Contributor

Describe the bug

Environment: everyone
OS: everyone

The cmake_lib template of conan new command does generate not invalid CMake code, but redundant.
On test_package/CMakeLists.txt it generates find_package directives of every dependency passed as -d requires parameter and it should only generate the find_package of the main package, delegating the finding of transitive dependencies to the original package.

How to reproduce it

$ conan new cmake_lib -d name=sdk -d version=1.0 -d requires="lib_a/1.0" -d requires="lib_b/1.0"
File saved: CMakeLists.txt
File saved: conanfile.py
File saved: include/sdk.h
File saved: src/sdk.cpp
File saved: test_package/CMakeLists.txt
File saved: test_package/conanfile.py
File saved: test_package/src/example.cpp
$ cat test_package/CMakeLists.txt
cmake_minimum_required(VERSION 3.15)
project(PackageTest CXX)

find_package(sdk CONFIG REQUIRED)

find_package(lib_a CONFIG REQUIRED)    # This find_packages are incorrect. 
find_package(lib_b CONFIG REQUIRED)    # Conan should delegate on sdk generator to find their transitive dependencies


add_executable(example src/example.cpp)
target_link_libraries(example sdk::sdk)
@czoido
Copy link
Contributor

czoido commented Jun 10, 2024

Closed by #16451

@czoido czoido closed this as completed Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants