samedi 23 septembre 2017

No rule to make target makefile when using an external library

I have attempted to troubleshoot this issue, but eventually I gave up and I cannot figure it out.

I am using CLion and I need to import an external shared library (ts3client.so). Whatever I do, it fails in one way or another.

Currently, I have the following:

cmake_minimum_required(VERSION 3.8)
project(TSMusicBot)

set(CMAKE_CXX_STANDARD 11)

set(SOURCE_FILES src/main.cpp)

# Teamspeak Libraries
INCLUDE_DIRECTORIES(libs/ts3_sdk_3.0.4/include)

ADD_LIBRARY (libts3client SHARED IMPORTED GLOBAL)
SET_PROPERTY (
        TARGET libts3client PROPERTY IMPORTED_LOCATION
        libs/ts3_sdk_3.0.4/bin/linux/amd64/libts3client.so)

add_executable(TSMusicBot ${SOURCE_FILES})

target_link_libraries(TSMusicBot libts3client)

This gives me the following error:

make[2]: *** No rule to make target 'libs/ts3_sdk_3.0.4/bin/linux/amd64/libts3client.so', needed by 'TSMusicBot'.  Stop.
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/TSMusicBot.dir/all' failed
make[1]: *** [CMakeFiles/TSMusicBot.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

My directory structure is the following: src/main.cpp (the code) libs/ts3_sdk_3.0.4/include/teamspeak/ (which contains headers for the library) libs/ts3_sdk_3.0.4/bin/linux/amd64/libts3client.so (which is the library I cannot import).

Aucun commentaire:

Enregistrer un commentaire