Search code examples
c++cmakeclionglfw

CLion IDE (CMake): Project builds but no intelligence for external libraries


I've implemented the GLFW basic example.

The GLFW header file is reported as not being found and such the CLion IDE is reporting and error and not providing intellisense however the project correctly compiles and runs.

I've added the GLFW library as per the guidance in their documentation (See CMakeLists.txt).

The project is being built and run remotely on Ubuntu 20.04.

main.cpp

#include <GLFW/glfw3.h>

int main(void)
{
    GLFWwindow* window;

    /* Initialize the library */
    if (!glfwInit())
        return -1;

    ...
}

CMakeLists.txt

project(untitled1)

set(CMAKE_CXX_STANDARD 14)
set(SOURCE_FILES main.cpp)


find_package(glfw3 3.3 REQUIRED)

add_executable(untitled1 ${SOURCE_FILES})
target_link_libraries(untitled1 glfw)

Solution

  • For anyone encountering this issue call Tools | Resync with Remote Hosts -