question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[feature] --target argument for conan build

See original GitHub issue

Following the broader discussion in #5553 i suggest the following feature mainly relevant for CI but also for local development: For doing “non-standard” builds like generating documentation output or running a static code analysis people usually create optional build targets in the used build system, e.g. CMake.

As there is most probably no need to include the generated files in the Conan packages, the build is done with conan install && conan build in the userspace to easily access the files for uploading, archiving, … To avoid having to call the underlying build system directly in the CI builds (may also be used locally by developers so they do not have to run activate.bat and call CMake directly with all required parameters), the actual build target could be passed directly with e.g. conan build --target docs to the build() method, similar to the --configure, --build, --test flags and the respective attributes.

This would avoid having to add dedicated options for all these “non-standard” builds in the conanfile.py which are not used for package creation anyway.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:3
  • Comments:16 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jgsogocommented, Aug 3, 2020

Hi! No news about this.

Conan v2.0 will include a new command-line interface that makes it possible to add user-defined commands (some preliminary PRs are already merged). This new CLI together with a good documentation of the Conan API opens a new set of possibilities, but IMHO it’s not enough for this --target argument/need.

I’m not sure if this is something desired for the conan build command or it is more related to the editables feature (install the package as editable and then run local tools/commands). We are facing many issues with the local developer workflow not behaving exactly the same way as the conan create and it might not be the best idea to add more complexity (or flexibility) to it if it is not 100% needed.

Maybe this issue is a symptom of something different: we usually don’t generate and package things like docs, benchmark results, static code analysis reports,… because we don’t need this information always, we don’t want to add more options and generate different packages with and without this extra files. If this is the symptom, it is more related to the ongoing discussions about quality artifacts, PDBs,… and we are thinking a way to handle this files and add them to the package if available without affecting the package-id.

0reactions
petermbauercommented, Dec 16, 2021

Thanks for sharing @RolfBippus, i also considered removing it from the package_id but for me its ok to produce different binary packages as the content depends on which target is built.

Read more comments on GitHub >

github_iconTop Results From Across the Web

conan build — conan 1.46.2 documentation
The --configure, --build, --install arguments control which parts of the build() are actually executed. They have related conanfile boolean variables ...
Read more >
Conan and resolving dependencies in a C++ project
Managing 3rd-party dependencies in a C++ project with Conan: automatic builds and deployment in TeamCity, storing artifacts in JFrog ...
Read more >
B2 User Manual - 1.81.0 - Boost C++ Libraries
To represent aspects of target configuration such as debug and release variants, or single- and multi-threaded builds portably, B2 uses features with ...
Read more >
Conan Package Manager for C++ in Practice - YouTube
By Jerry Wiltse, presented at Core C++ [online] meetup, March 2021. The slides can be found at http://bit.ly/ConanDemo, more links to Conan ......
Read more >
Cross-compiling a Conan package - c++ - Stack Overflow
This error occurs after Conan's build() function get's called for the fmt package. It calls cmake with the following arguments:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found