conan-io / cmake-conan

CMake wrapper for conan C and C++ package manager
MIT License
828 stars 251 forks source link

RelWithDebInfo and MinSizeRel build types not supported with cmake_multi generator #156

Open danimtb opened 5 years ago

danimtb commented 5 years ago

See comments in https://github.com/bincrafters/community/issues/867

I think the problem should be in this line not taking into account the new build types: https://github.com/conan-io/cmake-conan/blob/c6e5f37b2b0ab52ddc5b9c65e14ad3fd6f6b912f/conan.cmake#L477

However, I tried forcing CMAKE_BUILD_TYPE=RelWithDebInfo and it worked (with single configuration)

SSE4 commented 5 years ago

/cc @munoah

munoah commented 5 years ago

Random question: What is the change that broke it in conan / what was the behaviour before 1.16.0? did everything link against the Release libraries when relwithdebinfo was specified?

danimtb commented 5 years ago

For me it has the same behavior (works fine) with both Conan 1.16.1 and Conan 1.15.4 using this command:

$ cmake .. -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=MinSizeRel

The issue comes when you want to build with multi config:

$ cmake .. -G "Visual Studio 15 2017 Win64"
...

$ cmake --build . --config Debug
(OK)

$ cmake --build . --config MinSizeRel
(Fails due to conanbuildinfo_minsizerel.cmake not being generated in the first command)

So not sure what is failing in your side. Did you do those steps? Could you post here the commands used?

munoah commented 5 years ago

doesn't cmake just ignore the -DCMAKE_BUILD_TYPE=MinSizeRel when you have visual studio as the generator? I still get a sln file with all 4 build types and I can do cmake --build . --config Debug and then the compiler complains about value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' and stuff like that. I guess thats another problem, the check here https://github.com/conan-io/cmake-conan/blob/f2559b844620a834065d82ad9bc8d488934e2d47/conan.cmake#L468 for a multi_generator is not quite right, maybe it should use this property: get_cmake_property(CONAN_CMAKE_MULTI GENERATOR_IS_MULTI_CONFIG)

But I'm just confused about why using multi config worked before I updated to 1.16.0. I'm also not sure if building all libraries in relwithdebinfo is a good idea since a lot of libraries use standard makefiles or .sln files and these dont have the concept of relwithdebinfo

edit: with conan versions older than 1.16.0 the glm project from the original issue works fine for doing this: cmake .. -G "Visual Studio 15 2017 Win64" cmake --build . --config RelWithDebInfo

Malacath-92 commented 3 years ago

@czoido is this problem abandoned or am I missing a solution proposed somewhere else?