# My c project this is my project structure before compile ~/proj/CMakeLists.txt ~/proj/src/CMakeLists.txt ~/proj/src/main.cpp ~/proj/build/ ## input proj/CMakeList.txt ```cmake= cmake_minimum_required(VERSION 3.10) project(test) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) include_directories(/usr/local/include) add_subdirectory(src) ``` proj/src/CMakeList.txt ```cmake= find_package(OpenGL REQUIRED) find_package(GLUT REQUIRED) add_executable(test main.cpp) set(GL_LIBRARIES OpenGL::GL GLUT::GLUT) target_link_libraries(test ${GL_LIBRARIES}) ``` ## Output build/compile_command.json ```json [ { "directory": "/home/hanslu95/proj/src", "command": "/usr/bin/c++ -isystem /usr/local/include -o CMakeFiles/test.dir/main.cpp.o -c /home/hanslu95/proj/src/main.cpp", "file": "/home/hanslu95/proj/src/main.cpp", "output": "src/CMakeFiles/test.dir/main.cpp.o" } ] ``` compile_command.json ```json [ { "directory": "/home/hanslu95/proj/src", "command": "/usr/bin/c++ -isystem /usr/local/include -o CMakeFiles/test.dir/main.cpp.o -c /home/hanslu95/proj/src/main.cpp", [ { "directory": "/home/hanslu95/proj/build/src", "command": "/usr/bin/c++ -isystem /usr/local/include -o CMakeFiles/test.dir/main.cpp.o -c /home/hanslu95/proj/src/main.cpp", "file": "/home/hanslu95/proj/src/main.cpp", "output": "src/CMakeFiles/test.dir/main.cpp.o" } ] ``` ## Final Result 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up