1

I am attempting to get a multi-config cmake build working using conan.cmake. I am also following along with the cmake_multi docs.

It seems that in the docs for cmake_multi, they require that you both pass -g cmake_multi and -s build_type={type} ({type} being Release/Debug/...).

However, in conan.cmake it does not look like the current build_type is passed on when calling conan install -g cmake_multi ....

I am hitting a situation now where if I run with the configurations "Release;Debug" conan reports that a bunch of packages are missing

Requirements
    boost/1.71.0@conan/stable from 'my_repo' - Cache
    libconfig/1.6@internal/custom from 'my_repo' - Cache
    ...
Packages
    boost/1.71.0@conan/stable:5b939a5d59f5432d9263459d17f2acb1535629bd - Missing
    libconfig/1.6@internal/custom:ef44119b64b51a15f7b334090b2ff53fddcc38df - Missing
    ...

However if I edit conan.cmake to also pass "-sbuild_type=${CMAKE_BUILD_TYPE}" at the end of conan_args, it is able to find my packages for both Release and Debug.

Could anyone see what I may be doing wrong here? I do not specify a build_type in my conan profile, nor is one already set as part of my settings.

5
  • Try adding --build missing? Conan centre doesn't always have prebuilt debug packages so you need to build them yourself (if i remember correctly the Conan command tells you to do this in its error output) Commented Dec 30, 2020 at 0:20
  • @AlanBirtles thanks for the great suggestion. I added BUILD missing (and experimented with BUILD outdated) but get error messages during compilation from several packages that build_type setting should be defined. Commented Dec 30, 2020 at 14:42
  • Have you tried github.com/conan-io/cmake-conan, it takes care of this stuff for you Commented Dec 30, 2020 at 17:09
  • @AlanBirtles I am! I linked it above in the question, but I guess not super obvious. Commented Dec 31, 2020 at 16:49
  • If you're using that you shouldn't need to call Conan at all,cmske should do it for you with the correct parameters, I've used it for multi configuration generators and it just worked without having to do anything Commented Dec 31, 2020 at 19:09

1 Answer 1

3

After reading the source code for conan.cmake a few more times I discovered that it is possible to have it propagate the build type, you just need to use the PROFILE_AUTO argument to conan_cmake_run.

conan_cmake_run(
   PROFILE ${CONAN_PROFILE}
   CONFIGURATION_TYPES ${CONFIGURATION_TYPES}
   PROFILE_AUTO build_type  # Use build_type as detected by CMake, override any values in the profile
   BUILD outdated
)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.