How do I add a linker option into my CMakeLists.txt for ChartDirector

32 Views Asked by At

I've got an example makefile given from ChartDirector that compiles what I want correctly, but I want to convert it to cmake to use the code in a larger project involving cmake.

Relevant Makefile code:

CC = g++
CFLAGS = -Idependencies/ChartDirector/include -Ldependencies/ChartDirector/lib -Wl,-Rdependencies/ChartDirector/lib
LIBS = -lchartdir
TARGET = main

Current CMakeLists.txt

cmake_minimum_required(VERSION 3.12)
project(main VERSION 1.0)
add_executable(main main.cpp)

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/dependencies/ChartDirector/include)
target_link_directories(main PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/ChartDirector/lib)

I think all i'm missing is the linker option -Wl,-Rdependencies/ChartDirector/lib. Cmake will run with this, but the makefile won't find everything it needs.

0

There are 0 best solutions below