0

I found in Clion cmake always add -G "CodeBlocks - Unix Makefiles" parameter. It made the generation of camke different at using cmake ../

As you can see, I didn't add any parameter at CMake options. But CLion add -G "CodeBlocks - Unix Makefiles".

According by jetbrains. This feature will be fixed, but don't know when.CLion CMake default generator is CodeBlocks - Makefiles.

If you build OpenCV by CLion you will find CMake error at last like below. This is caused by -G "CodeBlocks - Unix Makefiles"

Problems were encountered while collecting compiler information:
cc1plus: fatal error: /--/--/cmake-build-release/modules/calib3d/perf_precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/calib3d/perf_precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/calib3d/perf_precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/calib3d/perf_precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/calib3d/perf_precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/calib3d/perf_precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/core/precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/core/precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/core/precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/core/precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/core/precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/core/precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/core/precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/core/precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/core/precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/core/precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/core/precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/core/precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/core/precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/core/precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/core/precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/core/precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/core/precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/core/precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/core/precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/core/precomp.hpp: No such file or directory
cc1plus: fatal error: /--/--/cmake-build-release/modules/core/precomp.hpp: No such file or directory
3
  • 1
    Why do you bother what CLion does internally to get your code running? Please elaborate this in more detail, since it seems that your actual problem is something else. Commented Apr 8, 2019 at 14:19
  • Please don't see downvotes (btw, it's not from me) as an offense but more as a strong indication that the quality of the question should be improved. My comment is meant as a hint to help you improving your question. I do want to help you and provide you with a high-quality answer. But to do so, I need properly understand your problem and thus need some more Information. Commented Apr 9, 2019 at 8:53
  • As my guess CLion will add -G parameter automatic and can't be deleted. But you know what when I try to build OpenCV source in CLion. There are many warning about perf_precomp.hpp precomp.hpp test_precomp.hpp have relationships with that parameter. Because when I use command line cmake, there are no errors again. I think it might be same problem as github.com/sakra/cotire/issues/124. Commented Apr 9, 2019 at 9:56

1 Answer 1

2

To answer your question: You can't change the makefile generator in CLion and you don't have to.

Let me explain why:

If you read the output carefully, you will see the following just before all the error messages:

-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/opencv/cmake-build-debug

This indicates that the actual configuration of the CMake project succeeded. Furthermore, CLion populates the Run/Debug Configuration drop-down with a lot of targets. The CMake configuration is just fine, you can code, compile and run everything. If CMake had failed, this would not be the case.

However, after CMake is finished, CLion wants to perform some extra magic (I don't know about that). And that is where all the error messages come from.

To get rid of it, you have to add the following flag to the CMake options in the CMake configuration dialog:

-DENABLE_PRECOMPILED_HEADERS=OFF.

By the way: The build type is defined via the drop down menu of the "Build Type:" option, there is no need to set it again in CMake options.


To conclude: Your question is a typical case of a XY-Problem. You want to solve the problem indicated by the error messages given by CLion. But instead of asking about this and providing the required information in your question, you were "asking about your attempted solution rather than your actual problem."

I just found the missing information in your answer post rather than the question, were it belongs. So it would be great if you could merge your posts into a comprehensive question.

This is not meant to be rude or offensive by no means. I just want to give you a hint on how you could improve your questions to prevent downvoting or staying unanswered.

Sign up to request clarification or add additional context in comments.

3 Comments

You indicated where the problem is, but why CMake CodeBlocks generator will make this still unknown to us. To be honest, thanks your time and really try to help me solve the problem. Apologizing for my offensive languages.
@EricLu You are right, the reason for the error messages is still not clear. However, it seems not to be caused by the generator, since when I run CMake on command line, the error does not occur: cmake -H/tmp/opencv -B/tmp/opencv/build -G "CodeBlocks - Unix Makefiles"
Sorry, you are right,it seems really like clion's magic.With code blocks generater system can not make the error happen,my mistake.

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.