New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved cmake compiler check message #5858
Conversation
" is not the one detected by CMake: '${CMAKE_CXX_COMPILER_ID}=" ${VERSION_MAJOR}.${VERSION_MINOR}') | ||
message(FATAL_ERROR "The installed dependencies are for compiler.version=${CONAN_COMPILER_VERSION}," | ||
"but the compiler version CMake is using is ${VERSION_MAJOR}.${VERSION_MINOR}.\n" | ||
"Please, check your default profile settings (conan profile show default) or your compiler (${CONAN_COMPILER})") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good, but the error will also appear if not using the default profile but a custom profile, and the compiler doesn't match. Could you please put it in a generic way? Thanks!
Yeah sure. I've thought something like: Detected error in your Conan profile: compiler type or compiler version differs from the one detected by CMake Or something like that |
message(FATAL_ERROR "Incorrect '${CONAN_COMPILER}' version 'compiler.version=${CONAN_COMPILER_VERSION}'" | ||
" is not the one detected by CMake: '${CMAKE_CXX_COMPILER_ID}=" ${VERSION_MAJOR}.${VERSION_MINOR}') | ||
if(NOT "${CONAN_COMPILER}" STREQUAL "${CMAKE_CXX_COMPILER_ID}") | ||
message(FATAL_ERROR "Detected a mismatch between your conan profile settings and the compiler CMake has detected:\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is not necessary, the file already has a check for compiler mistmach, and and error message, before getting to the version one. Check:
if (NOT CMAKE_CXX_COMPILER_ID MATCHES ${EXPECTED_CMAKE_CXX_COMPILER_ID})
message(FATAL_ERROR "Incorrect '${CONAN_COMPILER}'. Toolset specifies compiler as '${EXPECTED_CMAKE_CXX_COMPILER_ID}' "
"but CMake detected '${CMAKE_CXX_COMPILER_ID}'")
endif()
The error message is perfect now, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But if we don't check here again against CONAN_COMPILER, than the error happens in case of profile mismatch, as you commented previously in the other commit. I can remove that part of not required and not desired
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if I follow. CONAN_COMPILER is checked before calling check_compiler_version()
, so in theory, inside check_compiler_version()
it is not possible that there is a compiler mismatch. What am I missing here? There is probably something that I dont see.
Thanks! These UX improvements are great, they might help to a few users! |
Changelog: Fix: Improved cmake compiler check message to explain the problem with different compiler versions when installing dependencies
Docs: Omit
develop
branch, documenting this one.Note: By default this PR will skip the slower tests and will use a limited set of python versions. Check here how to increase the testing level by writing some tags in the current PR body text.