[Solved] CMake Error in CLion 2018.3.3 But NOT in CLion 2018.2.7
Answered
I have a project that is for a stand-alone FPGA. I can't compile it in CLion (must use vendor's compiler), but I have been using CLion for source code editing anyway because the navigation in CLion all works great and is EXTREMELY useful.
Until now. I updated to CLion 2018.3.3 and now I get the following error, and source code navigation no longer works (I have made NO changes to any files, including the CMakeLists.txt file). I installed CLion 2018.2.7 and everything works as before, so it's definitely something in CLion 2018.3.3.
CMake Error: Attempt to add a custom rule to output "/home/project/src/cmake-build-debug/CommonStatus.pb.h.rule" which already has a custom rule.
-- Configuring incomplete, errors occurred!
See also "/home/project/src/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "/home/project/src/cmake-build-debug/CMakeFiles/CMakeError.log".
I can provide the CmakeLists.txt file privately if you'd like, but not any other source code...
Please sign in to leave a comment.
Hello! Not sure that the issue is CLion-related. Might be CMake-related also. Is this CMake project loaded successfully outside CLion (from Terminal) with CMake 3.13.2 bundled with CLion 2018.3.3?
Thanks, Anna!
You're right (as usual). Running on the command line outside of CLion, the error occurs if I run the cmake that came with CLion 2018.3.3 (cmake version 3.13.2) but not the cmake that came with CLion 2018.2.7 (cmake version 3.12.3).
I have no idea how to troubleshoot that (I will search cmake forums). Any suggestions?
UPDATE: Downloaded and tried cmake 13.3.3, same problem.
But I figured out a workaround. I should read the error messages more carefully: I had an add_custom_command() in my CMakeLists.txt file that ran a shell script. I can run the shell script manually outside of CLion, so I commented that line out and no more error! One day I might take the time to figure out what was wrong with that command, but for now all is good.
Thanks for your help!
I'm glad you've found a workaround! If you find a solution one day, I kindly ask you to share it here too. Thanks!