Quantcast
Channel: CMake user built libraries; cannot specify link libraries for target - Stack Overflow
Viewing all articles
Browse latest Browse all 2

CMake user built libraries; cannot specify link libraries for target

$
0
0

I'm building a project in Cpp that will communicate with my Java apps via rabbitmq and post updates to twitter. I'm using a few libraries from github

  1. rabbitmq-c

    Rabbit installed to /usr/local/lib64

  2. jansson - json library

    I installed this a while back for another project, went to /usr/local/lib

  3. twitcurl - C lib for Twitter API

    Got installed to /usr/local/lib

If it matters, I'm using CLion as my IDE, which displays jansson and rabbit under auto-complete when defining includes - so that's picking the libs off my system somehow

e.g.#include <jansson.h>#include <amqp.h>

I link them using the target_link_libraries(name libs...) and I see output saying

build$ cmake ..CMake Error at CMakeLists.txt:30 (target_link_libraries):  Cannot specify link libraries for target "twitcurl" which is not built by  this project.

I set LD_LIBRARY_PATH

export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64

I try to set the CMAKE_LIBRARY_PATH to include usr/local/lib and lib64 but doesn't seem to have any effect. Here's my CMakeLists.txt file

## This is a CMake makefile.  You can find the cmake utility and# information about it at http://www.cmake.org#cmake_minimum_required(VERSION 2.6)set(PROJECT_NAME twitterUpdater)set(SOURCE_FILES main.cpp)set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "/usr/local/lib""/usr/local/lib64")project(${PROJECT_NAME})find_package(X11 REQUIRED)find_package(OpenCV REQUIRED)IF (X11_FOUND)    INCLUDE_DIRECTORIES(${X11_INCLUDE_DIR})    LINK_LIBRARIES(${X11_LIBRARIES})ENDIF ( X11_FOUND )IF (OpenCV_FOUND)    include_directories(${OpenCV_INCLUDE_DIRS})    link_libraries(${OpenCV_LIBS})ENDIF(OpenCV_FOUND)add_executable(${PROJECT_NAME} ${SOURCE_FILES})target_link_libraries(${project_name} twitcurl jansson rabbitmq)

What's confusing me is another project I have uses jansson by simply adding it here TARGET_LINK_LIBRARIES(${project_name} dlib jansson)

What did I miss?? Thanks


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images