I am working on a project structure that is published at:
https://github.com/veritacodex/IB.Cpp.Api.Client
You probably have seen a similar structure where:
I managed to get all CMakeLists.txt files to work. It compiles and makes libraries nicely.
My problem comes when I try to use any object which is part of a shared third-party library. The IDE is not able to resolve any symbols.
I tried with Clion and VSCode and couldn't get any intellisense support. Am I missing anything in the way I link the external libraries?
These are the lines that link the third-party library:
INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/Library/inc)
SET(BUILD_SHARED_LIBS YES)
ADD_LIBRARY(IbApiClient IbClient.cpp)
TARGET_LINK_DIRECTORIES(IbApiClient PUBLIC ${CMAKE_SOURCE_DIR}/Third-Party/tws-api)
TARGET_LINK_LIBRARIES(IbApiClient PUBLIC libTwsSocketClient.so)
I found a solution.
One way to make the IDE aware of the headers folder is by using the following:
FILE(GLOB TWSAPI_SRC CONFIGURE_DEPENDS
"${TWSAPI}/*.h"
"${TWSAPI}/*.cpp"
)
ADD_LIBRARY(IbApiClient IbClient.cpp ${TWSAPI_SRC})
Where:
Full file at https://github.com/veritacodex/IB.Cpp.Api.Client/blob/main/library/src/CMakeLists.txt
Clion can resolve all symbols if set up this way.