You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for CONAN_INSTALL_BUILD_CONFIGURATIONS (#707)
* Add support for CONAN_INSTALL_BUILD_CONFIGURATIONS
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.
* use build_dir_multi fixture
* test: fix build dir
* fix logic around config override
* fixes
* Update conan_provider.cmake
Co-authored-by: Craig Scott <craig.scott@crascit.com>
* windows runtime tests: run on fresh build directory
* Update docs to mention single-config restriction
---------
Co-authored-by: Luis Caro Campos <3535649+jcar87@users.noreply.github.com>
* Only the `CMakeDeps` generator is specified - for build settings that would otherwise be provided by `CMakeToolchain` (for example, the compiler itself or other global build settings) please invoke Conan separately as per [documentation](https://docs.conan.io/2/tutorial/consuming_packages/build_simple_cmake_project.html).
52
52
* Currently this only works such that Conan can satisfy invocations to CMake's `find_package`. For dependencies that have logic outside of `find_package`, for example, by making direct calls to `find_program`, `find_library`, `find_path` or `find_file`, these may not work correctly.
53
-
* When using a single-configuration CMake generator, you must specify a valid `CMAKE_BUILD_TYPE` (can't be left blank)
53
+
* When using a single-configuration CMake generator, you must specify a valid `CMAKE_BUILD_TYPE` (can't be left blank). Alternatively, `CONAN_INSTALL_BUILD_CONFIGURATIONS` can be set to a non-empty list of build types (see next section).
54
54
* Deriving Conan settings is currently only supported on the most common platforms with the most popular compilers.
55
55
56
56
### Customizing Conan profiles
@@ -68,10 +68,25 @@ If you need to customize the profile, you can do so by modifying the value of `C
68
68
*`-DCONAN_BUILD_PROFILE="/path/to/profile"`: alternatively, provide a path to a profile file that may be anywhere in the filesystem.
69
69
*`-DCONAN_HOST_PROFILE="default;custom"`: semi-colon separated list of profiles. A compound profile will be used (see [docs](https://docs.conan.io/2.0/reference/commands/install.html#profiles-settings-options-conf)) - compunded from left to right, where right has the highest priority.
70
70
71
+
Any `build_type` specified by a host profile is ignored.
72
+
The `build_type` is handled separately, and the default behavior depends on the CMake generator used:
73
+
* For single-configuration generators, `conan install` is executed once with `build_type` set to the `CMAKE_BUILD_TYPE`. The `CMAKE_BUILD_TYPE` must not be empty.
74
+
* For multi-configuration generators, `conan install` is executed twice: once with `build_type` set to `Release`, and a second time with `build_type` set to `Debug`.
75
+
76
+
You can override the default build type(s) by setting the `CONAN_INSTALL_BUILD_CONFIGURATIONS` CMake variable to a list of build types.
77
+
`conan install` will then be invoked once for each build type.
78
+
This can be used with both single- and multi-configuration generators, although currently only one build type can be specified for single-configuration generators.
79
+
For example:
80
+
*`-DCONAN_INSTALL_BUILD_CONFIGURATIONS=Release;Debug`: execute `conan install` for both `Release` and `Debug` build types with a multi-configuration generator.
81
+
*`-DCONAN_INSTALL_BUILD_CONFIGURATIONS=Release`: execute `conan install` once for just the `Release` build type, applicable for both single- and multi-configuration generators.
82
+
71
83
### Customizing the invocation of Conan install
72
84
The CMake-Conan dependency provider will autodetect and pass the profile information as described above. If the `conan install` command invocation needs to be customized further, the `CONAN_INSTALL_ARGS` variable can be used.
73
85
* By default, `CONAN_INSTALL_ARGS` is initialised to pass `--build=missing`. If you customize this variable, please be aware that Conan will revert to its default behaviour unless you specify the `--build` flag.
74
-
* Two arguments are reserved to the dependency provider implementation and must not be set: the path to a `conanfile.txt|.py`, and the output format (`--format`).
86
+
* Some arguments are reserved for the dependency provider implementation and must not be set in `CONAN_INSTALL_ARGS`:
87
+
* The path to a `conanfile.txt|.py`.
88
+
* The output format (`--format`).
89
+
* The build type setting (`-s build_type=...`).
75
90
* Values are semi-colon separated, e.g. `--build=never;--update;--lockfile-out=''`
0 commit comments