Issues with Auto-generated CMakeLists.txt for syntax highlighting

已完成

I'm working with a huge C++ code base and have been using CLion decently for some repos. I'm compiling elsewhere so I'm only using Clion for syntax highlighting and code stepping. I'm having issues to get the syntax highlighting working with the biggest repo. Usually, I just auto-generate the CMakeLists.txt and customize it until the syntax highlighting is working. However, I'm now getting:

c++: error trying to exec '/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/cc1plus': execv: Argument list too long

The add_executable is quite big so I assume that's the problem? Is there a limit I can expand? Do I even need the add_executable for syntax highlighting? I tried to remove it and keep the include_directories commands. Syntax is showing alright but I can't step into the headers with the message "Cannot find declaration to go to".

0

Can you post the CMake here?????? 

0
Avatar
Permanently deleted user

Unfortunately not due to sensitive data. It contains ~1500 include_directories commands and ~10000 entries in add_executable.

0

It's hard to figure out how you can overcome the issue, but I think the issue is definitely to do with the number of arguments your CMake is internally generating to the "execv" function. The number of arguments that command takes usually is proportional to the stack size and it varies from machines to machines.

Unfortunately, you have no control over the structure of your project as you are using a generated CMake. Do you really need all the ~1500 include directories and the thousands of headers???? Would it be too difficult to manually creating a CMakeLists for this project???

0
Avatar
Permanently deleted user

Yes it's difficult to manually create due to the sheer size of the project. It's also dependent on Google Protobuf generated source files. I tried to include only the Protobuf source files and it resulted in the same error. Not sure how to deal with it. Seems VSCode can can handle the project somewhat although it has pros and cons as well. And the UI isn't something I like.

0
Avatar
Permanently deleted user

I managed to generate compile_commands.json files which seem to work with CLion. But the source files are not presented in the intended folder structure. It's pretty much displaying all source files without folders. Any way to correct this?

0

Sorry @..., I have never worked with "compile_commands.json" files that CMake generates, so I'll let someone else answer that question. Maybe CMake has an option to set the file paths as absolute in that "compile_commands.json" file?

0

请先登录再写评论。