cmake_multi

Warning

This is a deprecated feature. Please refer to the Migration Guidelines to find the feature that replaced this one.

The new, under development integration with CMake can be found in conan.tools.cmake. This is the integration that will become the standard one in Conan 2.0, and the below generators and integrations will be deprecated and removed. While they are recommended and usable and we will try not to break them in future releases, some breaking changes might still happen if necessary to prepare for the Conan 2.0 release.

This is the reference page for cmake_multi generator. Go to Integrations/CMake if you want to learn how to integrate your project or recipes with CMake.

This generator will create 3 files with the general information and specific Debug/Release ones:

  • conanbuildinfo_release.cmake: Variables adjusted only for build type Release

  • conanbuildinfo_debug.cmake: Variables adjusted only for build type Debug

  • conanbuildinfo_multi.cmake: Which includes the other two and enables its use and has more generic variables and macros.

Variables in conanbuildinfo_release.cmake

Same as conanbuildinfo.cmake with suffix _RELEASE

Variables in conanbuildinfo_debug.cmake

Same as conanbuildinfo.cmake with suffix _DEBUG

Macros available in conanbuildinfo_multi.cmake

conan_basic_setup()

This is a helper and general purpose macro that uses all the macros below to set all the CMake variables according to the Conan generated variables. See the macros below for detailed information.

macro(conan_basic_setup)
    set(options TARGETS NO_OUTPUT_DIRS SKIP_RPATH KEEP_RPATHS SKIP_STD SKIP_FPIC)
Parameters:
  • TARGETS (Optional): Setup all the CMake variables by target (only CMake > 3.1.2). Activates the call to the macro conan_target_link_libraries().

  • NO_OUTPUT_DIRS (Optional): This variable has no effect and it works as if it was activated by default (does not se fixed output directories and uses the default ones designated by CMake).

  • SKIP_RPATH (Optional): [DEPRECATED] Use KEEP_RPATHS instead. Activate CMAKE_SKIP_RPATH variable in OSX.

  • KEEP_RPATHS (Optional): Do not adjust the CMAKE_SKIP_RPATH variable in OSX. Activates the call to the macro conan_set_rpath()

  • SKIP_STD (Optional): Do not adjust the C++ standard flag in CMAKE_CXX_FLAGS. Deactivates the call to the macro conan_set_std().

  • SKIP_FPIC (Optional): Do not adjust the CMAKE_POSITION_INDEPENDENT_CODE flag. Deactivates the call to the macro conan_set_fpic().

Note

You can also call each of the following macros individually instead of using the conan_basic_setup().

conan_check_compiler()

Checks that your compiler matches the one declared in settings.

conan_output_dirs_setup()

Adjust the bin/ and lib/ output directories.

conan_global_flags()

Set the corresponding variables to CMake’s include_directories() and link_directories(). You can enable the variable CONAN_SYSTEM_INCLUDES in order to get directories included with the SYSTEM option.

conan_define_targets()

Define the targets for each dependency (target flags instead of global flags).

conan_set_rpath()

Set CMAKE_SKIP_RPATH=1 in the case of working in OSX.

conan_set_vs_runtime()

Adjust the runtime flags /MD, /MDd, /MT or /MTd for Visual Studio.

conan_set_std()

Set CMAKE_CXX_STANDARD and CMAKE_CXX_EXTENSIONS to the appropriate values.

conan_set_libcxx()

Adjust the standard library flags (libc++`, libstdc++, libstdc++11) in CMAKE_CXX_FLAGS.

conan_set_find_paths()

Adjust CMAKE_MODULE_PATH and CMAKE_PREFIX_PATH to the values of deps_cpp_info.build_paths.

conan_include_build_modules()

Includes CMake files declared in CONAN_BUILD_MODULES using the include(...) directive. This loads the functions or macros that packages may export and makes them available for usage in the consumers CMakeLists.txt.

conan_find_apple_frameworks(FRAMEWORKS_FOUND FRAMEWORKS)

Find framework library names provided in ${FRAMEWORKS} using find_library() and return the found values in FRAMEWORKS_FOUND.

Input variables for conanbuildinfo_multi.cmake

CONAN_CMAKE_SILENT_OUTPUT

Default to: FALSE

Activate it to silence the Conan message output.