EasyClangComplete: ECC not working on multi-directory projects

System Info

  • Sublime Text version: 3.2.2 Build 3211
  • Which system are you on: macOS Big Sur 11.0.1
  • Clang version: Apple clang version 12.0.0 (clang-1200.0.32.27)

What happens

ECC always uses the CMakeLists.txt file in the current directory instead of the one on the top directory. This is not an issue when used in small projects, but in my case I have a big project which is divided into multiple subprojects, each one inside its own folder. This means that if a file in a subproject uses a CMake function or macro defined in the top level CMakeLists.txt, everytime I save a file in a subproject I get a small popup with something like this:

CMake Error at CMakeLists.txt:43 (target_enable_warnings):
  Unknown CMake command "target_enable_warnings".


  -- Configuring incomplete, errors occurred!
  See also "/private/var/folders/pr/ktmp94p53jb2ybd9nf0vmtx80000gn/T/EasyClangComplete/cmake_builds/7dd95e06680fd5c46f5683aa2d917b26/CMakeFiles/CMakeOutput.log".
  See also "/private/var/folders/pr/ktmp94p53jb2ybd9nf0vmtx80000gn/T/EasyClangComplete/cmake_builds/7dd95e06680fd5c46f5683aa2d917b26/CMakeFiles/CMakeError.log".

(In this example, target_enable_warnings() is a function defined in the top level CMakeLists.txt)

Besides the inconvenience of having this small popup, ECC does not work since it failed to configure CMake.

Steps to reproduce

  1. Create a small project with the following structure:
    ๐Ÿ“‚ project_folder
    โ”œ ๐Ÿ“„ CMakeLists.txt 
    โ”” ๐Ÿ“‚ subproject
       โ”” ๐Ÿ“„ CMakeLists.txt
  1. Create a CMake function/macro or include a CMake module on the main CMakeLists.txt, and use said function/macro/module from the subproject CMakeLists.txt (project_folder/subproject/CMakeLists.txt)
  2. Create a SublimeText project with the same structure and enable ECC
  3. Modify any C/C++ file on the subproject. The popup will be shown and the configuration will fail since the subproject CMakeLists.txt file has no definitions for the function, macro or module.

Iโ€™m sorry if this is a mistake on my side, but Iโ€™ve tried lots of things and nothing fixed it. Iโ€™ve checked the configuration and I was unable to find a way to explicitly specify the CMakeLists.txt file to be used. If this setting could be added (or just default to using the main file instead of the subproject files), this issue could be easily fixed. I remember this wasnโ€™t an issue some months ago, but I guess you changed the file to be used because of performance issues and thatโ€™s when I started to have problems. I ignored this issue for a while but now it has become unbearable since 90% of my subprojects canโ€™t be used with ECC and I have to disable it completely.

Thanks for your time and for making such awesome tool! ๐Ÿ˜„

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20 (10 by maintainers)

Most upvoted comments

No worries. Glad I could help.