Rosanswers logo

I have a problem when trying to run catkin_make, i am trying to build a package that uses opencv, i have added in CMakeLists : find_package(OpenCV) include_directories(${OpenCV_INCLUDE_DIRS}) target_link_libraries(my_awesome_library ${OpenCV_LIBRARIES}) but running catkin_make i get the folowing problem:

CMake Error at wificam/CMakeLists.txt:168 (target_link_libraries): Cannot specify link libraries for target "my_awesome_library" which is not built by this project.

any idead what can I do? thanks a lot

EDIT 1: this is it

cmake_minimum_required(VERSION 2.8.3)

find_package(catkin REQUIRED COMPONENTS





   #target_link_libraries(my_awesome_library ${OpenCV_LIBRARIES})

add_executable(wificamp src/wificamp.cpp)
target_link_libraries(wificamp ${catkin_LIBRARIES})

add_executable(wificampc src/wificampc.cpp)
target_link_libraries(wificampc ${catkin_LIBRARIES})

add_executable(wificampb src/wificampb.cpp)
target_link_libraries(wificampb ${catkin_LIBRARIES})

add_executable(wificams src/wificams.cpp)
target_link_libraries(wificams ${catkin_LIBRARIES})

add_executable(testbridge src/testbridge.cpp)
target_link_libraries(testbridge ${catkin_LIBRARIES})

it is comented because if not i could not build it, how should I define that cmake target? I thought i had done it like it is explained in the opencv ros tutorial, i am still a noob sorry and thanks a lot

Originally posted by Kailegh on ROS Answers with karma: 146 on 2015-01-25

Post score: 1


1 Answer 1


Rosanswers logo

This sort of error indicates that you haven't defined a cmake target called my_awesome_library.

The name of your cmake target is the first argument to add_executable(...) or add_library(...).

It may be useful to edit your question to include your full CMakeLists.txt if you would like more help.


Your first CMake target is name wificamp; therefore your linking command should be:

target_link_libraries(wificamp ${OpenCV_LIBRARIES})

You can also combine this with the linking command that links your exectuable against the catkin libraries:

target_link_libraries(wificamp ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})

Originally posted by ahendrix with karma: 47576 on 2015-01-26

This answer was ACCEPTED on the original site

Post score: 2


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.