1

This is similar to Including directories in Clion, but after following the accepted answer there I made no progress.

I'm trying to edit a large OSS project in CLion. It does not use CMake, so CLion has generated a CMakeLists.txt file. When I open a source file, it is unable to resolve includes that use sub directories:

Problem illustrated

The file this screenshot is from is in the same "opto" subdirectory it is importing from. If I change the imports to not include "opto" it works fine, but I can't do that, since this is a major project and I'm just wanting to write a small patch:

$ find . -type f | wc -l
10532

I've added the file I'm importing directly to add_executable as suggested in the other answer:

# CMakeLists.txt
add_executable(hotspot
    [lots of other files]
    src/share/vm/opto/compile.hpp
)

And I've added the opto directory to include_directories as outlined in the second answer to the other question:

# CMakeLists.txt
include_directories(
    src
    src/share/vm/opto)

Neither is helping CLion resolve imports via the opto subdirectory.

What am I missing?

Jacob Davis-Hansson
  • 2,603
  • 20
  • 26
  • > since this is a major project and I'm just wanting to write a small patch Then you'll have a better luck with a text editor instead of an IDE. Since it's a big project, you cannot use a trivial listfile, since it's a small patch, you are able to use the text editor. So I don't see, why not. –  Dec 22 '17 at 15:26
  • 1
    I have the same problem. Did you find the solution to this? –  May 01 '18 at 22:58
  • Have you found a solution for this yet? – Sam Al-Ghammari Jun 26 '18 at 08:12

1 Answers1

2

Using include_directories() must do, but you have to mention each sub_directory separately. Below i have included two directories in the same way where one of it is sub_directory.

enter image description here

The Header files have successfully been detected by CLion.

enter image description here

Akhilesh
  • 51
  • 7