cmake_find_package_multi

Warning

This is an experimental feature subject to breaking changes in future releases.

This generator is similar to the cmake_find_package generator but it allows working with multi-configuration projects like Visual Studio with both Debug and Release. But there are some differences:

  • Only works with CMake > 3.0

  • It doesn’t generate FindXXX.cmake modules but XXXConfig.cmake files.

  • The “global” approach is not supported, only “modern” CMake by using targets.

Usage

$ conan install . -g cmake_find_package_multi -s build_type=Debug
$ conan install . -g cmake_find_package_multi -s build_type=Release

These commands will generate several files for each dependency in your graph, including a XXXConfig.cmake that can be located by the CMake find_package(XXX CONFIG) command, with XXX as the package name.

Important

Add the CONFIG option to find_package so that module mode is explicitly skipped by CMake. This helps to solve issues when there is for example a FindXXXX.cmake file in CMake’s default modules directory that could be loaded instead of the XXXXConfig.cmake generated by Conan.

The name of the files follows the pattern <package_name>Config.cmake. So for the zlib/1.2.11 package, a zlibConfig.cmake file will be generated.

See also

Check the section cmake_find_package_multi to read more about this generator and the adjusted CMake variables/targets.