Skip to content
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

Merged
merged 9 commits into from Oct 3, 2019
Merged

Improved cmake compiler check message #5858

merged 9 commits into from Oct 3, 2019

Conversation

madduci
Copy link
Contributor

@madduci madduci commented Oct 2, 2019

Changelog: Fix: Improved cmake compiler check message to explain the problem with different compiler versions when installing dependencies
Docs: Omit

  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.
  • I've opened another PR in the Conan docs repo to the 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.

" 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})")
Copy link
Member

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!

@madduci
Copy link
Contributor Author

madduci commented Oct 3, 2019

Yeah sure.
Actually, do you have any suggestion for the message?

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"
Copy link
Member

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!

Copy link
Contributor Author

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

Copy link
Member

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.

@memsharded memsharded merged commit d742b87 into conan-io:develop Oct 3, 2019
@memsharded memsharded added this to the 1.20 milestone Oct 3, 2019
@memsharded
Copy link
Member

Thanks! These UX improvements are great, they might help to a few users!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants