Skip to content

Conversation

craigscott-crascit
Copy link
Contributor

Let the user or project override the set of build types we execute the conan install command for. This is most useful for enabling projects to build only one configuration when using a multi-config generator, but it can also be used to install for multiple build types with a single-config generator.

Fixes: #705

@CLAassistant
Copy link

CLAassistant commented Sep 12, 2025

CLA assistant check
All committers have signed the CLA.

@craigscott-crascit
Copy link
Contributor Author

@jcar87 I've updated the docs, but don't know what you want to do for the tests. If you're happy to take care of that, please go ahead and push commits to my branch as needed.

Copy link
Member

@memsharded memsharded left a comment

Choose a reason for hiding this comment

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

This is looking good, many thanks for your contribution @craigscott-crascit

I'd like to have the feedback from @jcar87 too.

@craigscott-crascit
Copy link
Contributor Author

I fixed the failing test. Would be good to trigger another round of CI jobs to confirm that was the only problem.

@craigscott-crascit
Copy link
Contributor Author

I also added a couple of tests for the new CONAN_INSTALL_BUILD_CONFIGURATIONS variable. Not sure if that's following the style you're after, but hopefully it's in the ballpark.

@jcar87
Copy link
Contributor

jcar87 commented Sep 22, 2025

Thanks @craigscott-crascit for the PR and for taking the time to implement the tests - our test suite in cmake-conan is not very ergonomic, so we appreciate it!

Need to rebase this on top of develop2 after #698 was merged, happy to do so ourselves and take over the rest if you're okay with that? (although I suspect it will pass the tests just fine)

@craigscott-crascit
Copy link
Contributor Author

Need to rebase this on top of develop2 after #698 was merged, happy to do so ourselves and take over the rest if you're okay with that?

Yes, please take it over and push changes as you wish. Thanks.

Let the user or project override the set of build types we execute the
conan install command for. This is most useful for enabling projects to
build only one configuration when using a multi-config generator, but it
can also be used to install for multiple build types with a single-config
generator.
@jcar87 jcar87 force-pushed the build-configs-override branch from 03017e2 to dcd7407 Compare September 23, 2025 08:20
@jcar87
Copy link
Contributor

jcar87 commented Sep 23, 2025

The tests are failing for a very interesting set of circumstances. (The main being that in that Test class, the build directory is reused and doing an actual build highlights an actual issue with the Conan CMakeDeps generator)

Need to discuss with @memsharded tomorrow, when we have a single config CMake generator, runing conan install on multiple configurations will cause files to overwrite each other in the generators folder, and if the installed configuration differs from the "self" configuration, we need to use a the &:build_pattern=${CMAKE_BUILD_TYPE} to tell Conan what the actual build time for the top-level self project is.

For a multi config generator, I'm not sure 100% it would be an issue, but double checking.

for what it's worth, all of these problems should go away with the CMakeConfigDeps generators, which intends to output files that much closer to what CMake itself would (with the added bonus of being able consume config files inside the packages too)

`conan install` will then be invoked once for each build type.
This can be used with both single- and multi-configuration generators.
For example:
* `-DCONAN_INSTALL_BUILD_CONFIGURATIONS=Release;Debug`: execute `conan install` for both `Release` and `Debug` build types, even for single-configuration generators.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we're saying only a single value can be given in CONAN_INSTALL_BUILD_CONFIGURATIONS when using a single-config generator, then this needs to be reworded.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, working on this!

@craigscott-crascit
Copy link
Contributor Author

...all of these problems should go away with the CMakeConfigDeps generators, which intends to output files that much closer to what CMake itself would (with the added bonus of being able consume config files inside the packages too)

I cannot express how happy the end of that comment makes me. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make the installed build configurations overridable

4 participants