-
-
Notifications
You must be signed in to change notification settings - Fork 446
conan doesn't recieve CC/CXX variables from CLion #40
Comments
Can you build the project from the command line? That would be an easy way to rule out clion as the culprit. |
I'm surprised to say that yes, I can. Running the command-line quoted above succeeds without problems. So now I'm speculating that CLion somehow messes up the environment and in that way triggers the failure? Odd... |
And indeed, to trigger the failure I'm observing from the commandline, I have to execute
I.e. set CXX and CMAKE_CXX_COMPILER to conflicting values |
Ok, then we know for certain that CLion is the problem, and not this project or conan. You will need to set up a new toolchain and a new cmake profile. To do that, you go to: The documentation you want should be here: https://www.jetbrains.com/help/clion/how-to-switch-compilers-in-clion.html. This page should be able to help you a lot better than I can. |
I have now been able to reproduce the problem from the commandline Preparation:
Trigger the problem:
The final Instead of that final |
According to conan-io/conan#1211, conan runs the compiler specified by the CC and CXX environment variables, not the cmake variables CMAKE_C_COMPILER and CMAKE_CXX_COMPILER. That thread suggests using conan profiles to set these variables, but that requires some modifications to cmake/Conan.cmake (see #32 if you want to do this). I think it's easier to just set CC and CXX via command line. Try this:
If this works, you will need to convince CLion to inject those environment variables into the build command. The documentation linked in my last post explains how to do that. |
This addresses issue cpp-best-practices#40
This addresses issue cpp-best-practices#40
This fixes cpp-best-practices#40 when building using an alternate compiler like `clang`.
I got it to work applying the fix from #122 to the
But i am not convenient enough about this to say that it is good and the right way to do it. |
This is fixed in ProjectOptions v0.11.2 |
Testcase:
Expected result
Actual result
/home/kees-jan/opt/clion-2019.3.5/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=/usr/bin/clang-10 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-10 -G "CodeBlocks - Unix Makefiles" /home/kees-jan/src/cpp_starter_project
Analysis
CC
andCXX
variables to be set, in addition to the compiler settings, and they are not.The text was updated successfully, but these errors were encountered: