VSCode cannot find package but CLion can (CMake)

792 views Asked by At

I was wondering what the difference is between using cmake and (compile_commands and compile_flags) in VSCode? I'm running into an issue where even though I've got my CMake set up correctly (builds just fine on Clion), I run into issues when trying to use the exact same code in VSCode.

I've got the offending line below

#include "palisade.h"

where palisade is installed in "/usr/local/include/palisade" and my CMake explicitly looks for it and finds it

find_package(Palisade)


I've also generated the file compile_commands.json

via cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1

but I'm still running into issues of the library not being found

1

There are 1 answers

0
RTS007 On

Probably it will helps.

In main CMakeLists.txt add line

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

and in c_cpp_properties.json

"compileCommands": "${workspaceFolder}/build/compile_commands.json"

This will allow InteliSence to use the dependencies created by cmake.