G
G
Grigory Dikiy2016-09-30 08:56:52
C++ / C#
Grigory Dikiy, 2016-09-30 08:56:52

Clion & Cmake connecting shared libraries?

Good afternoon. I made a dynamic library for my needs. And accordingly, in the project, if I compile through g ++, I perform a list of actions:

g++ -c main.cpp
g++ -o binary main.o -LDebug -lExtension -lSDL2 -Wl,-rpath,Debug

And I get a workable program that fulfills all the requirements. Debug - folder where the libExtension.so library is stored. Everything would be fine, but I cannot bind such an assembly to cmake in cilion. At the moment cimakelist looks like this:
cmake_minimum_required(VERSION 3.6)
project(1_)

set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

find_package(SDL2 REQUIRED)


if(SDL2_TRUE)
    include_directories(${SDL2_INCLUDE_DIR})
endif()

set(SOURCE_FILES main.cpp sources/Display.cpp headers/Display.h)
add_executable(${PROJECT_NAME} ${SOURCE_FILES})

target_link_libraries(${PROJECT_NAME} ${SDL2_LIBRARY})
target_link_libraries(${PROJECT_NAME} Extension)

How can one still specify cmake or build flags as when building directly with g++ or are there any other ways?
PS I'm not good at cmake

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question