cmake-conan icon indicating copy to clipboard operation
cmake-conan copied to clipboard

CMake multi always uses Release and Debug

Open maufl opened this issue 4 years ago • 3 comments

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?

maufl avatar Aug 09 '19 08:08 maufl

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.

maufl avatar Aug 09 '19 08:08 maufl

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...

macdew avatar Nov 25 '19 11:11 macdew

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})

rasjani avatar Mar 27 '20 09:03 rasjani