Skip to content

Make the installed build configurations overridable #705

@craigscott-crascit

Description

@craigscott-crascit

In the conan_provide_dependency() implementation, the current logic hard-codes the build configurations that are installed:

        get_property(_multiconfig_generator GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
        if(NOT _multiconfig_generator)
            message(STATUS "CMake-Conan: Installing single configuration ${CMAKE_BUILD_TYPE}")
            conan_install(${_host_profile_flags} ${_build_profile_flags} ${CONAN_INSTALL_ARGS} ${generator})
        else()
            message(STATUS "CMake-Conan: Installing both Debug and Release")
            conan_install(${_host_profile_flags} ${_build_profile_flags} -s build_type=Release ${CONAN_INSTALL_ARGS} ${generator})
            conan_install(${_host_profile_flags} ${_build_profile_flags} -s build_type=Debug ${CONAN_INSTALL_ARGS} ${generator})
        endif()

However, projects may want to have direct control over which configurations of its dependencies should be used (I have multiple consulting clients where this is the case in their production projects). For example, an organisation may want to always use Release builds for its dependencies on non-Windows because they don't care about debugging into dependencies, but they may be sensitive to the runtime performance of those dependencies.

I propose adding support for a new CONAN_INSTALL_BUILD_CONFIGURATIONS variable. If it is not defined, the logic is the same as right now. If the variable is defined, we install the specified dependencies instead. I have a relatively small patch with that change ready, although it still needs doc and test updates. I may need some guidance on the test parts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions