Browse postgresql source code in clion Follow
Answered
I want to set up postgres source code locally in CLion so that I can browse it. But clion doesn't understand include clauses. It looks like this:
I've tried pretty much everything I could find by "postgres" + "clion" search term combination, but still no luck. I bet it has something to do with includes specified in CMakeLists.txt. I tried the following options:
cmake_minimum_required(VERSION 3.6)
project(postgres)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
add_custom_target(postgres COMMAND make -C ${postgres_SOURCE_DIR})
and
cmake_minimum_required(VERSION 3.6)
project(postgres)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
include_directories (${postgres_INCLUDE_DIRS})
link_directories(${postgres_LIBRARY_DIRS})
add_custom_target(postgres COMMAND make -C ${postgres_SOURCE_DIR})
and
cmake_minimum_required(VERSION 3.6)
project(postgres)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
include_directories(SYSTEM./src)
add_custom_target(postgres COMMAND make -C ${postgres_SOURCE_DIR})
and a bunch of other options, but, yeah, still no luck.
The situation is complicated by the fact that I'm totally unfamiliar with C ecosystem, so I'm sorry if I'm being dumb.
Please sign in to leave a comment.
Hello!
The PostgreSQL project (https://github.com/postgres/postgres) is an Autotools project. CLion supports Autotools projects - https://www.jetbrains.com/help/clion/gnu-autotools.html.
According to our testing, the PostgreSQL project should work, please see https://youtrack.jetbrains.com/articles/CPP-A-179994647.
So you don't need to create a fake CMakeLists.txt in order to work with the PostgreSQL project in CLion. You can open it as an Autotools project in CLion. Please close the project (`File | Close Project`), delete the .idea subfolder and the CMakeLists.txt file, on the Welcome Screen select `Open` and choose the PostgreSQL project folder (which contain the top-level Makefile, the configure file etc.).