cmake-conan
cmake-conan copied to clipboard
CMake multi always uses Release and Debug
According to https://github.com/conan-io/cmake-conan/blob/develop/conan.cmake#L479 in cmake multi mode, conan is always run for "Release" and "Debug". Would it not make more sense to read the available build types from CMAKE_CONFIGURATION_TYPES
?
Ok, I immediately found out that conan install
with the cmake_multi
generator also always expects "Release" and "Debug", so this can't be fixed just in cmake-conan.
We've spotted the same issue in this cmake script, replaced it with:
foreach(CMAKE_BUILD_TYPE ${CMAKE_CONFIGURATION_TYPES})
message("Running Conan for build type=${CMAKE_BUILD_TYPE}")
set(ENV{CONAN_IMPORT_PATH} ${CMAKE_BUILD_TYPE})
conan_cmake_settings(settings ${ARGV})
conan_cmake_install(SETTINGS ${settings} ${ARGV})
endforeach()
This appears to work well for all of our configurations: Debug, Release, RelWithDebInfo. I do remember some issues in the past with conan's cmake_multi generator, but not recently. Perhaps try upgrading your conan install too? Our RelWithDebInfo definitely works...
Would setting CONFIGURATION_TYPES to include the buildt types you are lacking help ? Im not using cmake_multi generator, only cmake_find_package_multi and by default it also generated debug & release only but passing something like this helped:
conan_cmake_run(CONANFILE ${ROOT_CONANFILE} BASIC_SETUP UPDATE TARGETS CONFIGURATION_TYPES "Release;Debug;RelWithDebInfo" ${CONAN_SILENT_MODE})