First of all, to use Clangd's LSP feature, I set set(CMAKE_EXPORT_COMPILE_COMMANDS ON) in CMakeLists.txt. This makes the compile commands to be written to the compile_commands.json file, which helps the language server understand the project structure.
However, using cmrc_add_resource_library() in CMakeLists.txt causes some header files to not recognize other header files. For example, the project structure is as follows
First of all, to use Clangd's LSP feature, I set
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
in CMakeLists.txt. This makes the compile commands to be written to the compile_commands.json file, which helps the language server understand the project structure.However, using
cmrc_add_resource_library()
in CMakeLists.txt causes some header files to not recognize other header files. For example, the project structure is as followsin this case, if header1.h imports header2.h, LSP says it could not find the file. (However, it will compile and build normally!)