0

I am trying to solve this thing for quite some time. After a few hours I just decided to post a question because I am out of ideas. I imported a project into CLion with the CMakeLists.txt already inside. I am working on ubuntu and have the newest cmake version (3.5.something, OpenCV is 2.4.x). I use clion just for the IntelliSense, I wont be using it for the compilation anyway (I use terminal for that).

By opening the project I get following warning messages (which I somehow succeeded to reduce to warnings). This happens for every add_library line in OpenCVModules.cmake (I post just one of them):

CMake Warning (dev) at /usr/local/share/OpenCV/OpenCVModules.cmake:53 (add_library):
  ADD_LIBRARY called with SHARED option but the target platform does not
  support dynamic linking.  Building a STATIC library instead.  This may lead
  to problems.

Has anyone got ideas?

@CMakeLists.txt

# OpenCV:
find_package(OpenCV REQUIRED)
include_directories(${OPENCV_INCLUDE_DIR})
IF(OpenCV_FOUND)
  MESSAGE(STATUS "OpenCV_LIBS = ${OpenCV_LIBS}")
ELSE(OpenCV_FOUND)
  MESSAGE(STATUS "OpenCV_LIBS not found!")
ENDIF(OpenCV_FOUND)

project(cvtask1a)
file(GLOB SOURCES ${SOURCE_WILDCARDS})
include_directories(${CMAKE_SOURCE_DIR}/cgcvcommon)
add_executable(cvtask1a ${SOURCES})
target_link_libraries(cvtask1a ${OpenCV_LIBS})
Jumpman
  • 429
  • 1
  • 3
  • 10
  • 2
    Have you tried to google for error message? E.g., [this question](http://stackoverflow.com/questions/12264299/cmake-on-linux-target-platform-does-not-support-dynamic-linking) ask about the same error message. And its [second answer](http://stackoverflow.com/a/25844355/3440745) suggests to check that you don't forget about `project()` call before `find_package(OpenCV)`. – Tsyvarev Mar 20 '17 at 21:34
  • Can you post what your CmakeLists.txt looks like? By the way, I didn't downvoted your question, on the contrary, upvoted for it to offset the -1 :) You are welcome. – Darien Pardinas Mar 20 '17 at 21:49
  • are you using `find_package` in your CMakeLists.txt? – Darien Pardinas Mar 20 '17 at 21:50
  • Yap, did try both of these http://stackoverflow.com/questions/8711109/could-not-find-module-findopencv-cmake-error-in-configuration-process http://stackoverflow.com/questions/12264299/cmake-on-linux-target-platform-does-not-support-dynamic-linking The second one, I'm not actually sure on what "Source" folder is he referring to. @DarienPardinas Haha thanks :) I'll edit my post now and include cmakelists.txt And yeah I tried putting project on top and all I get then is following error message – Jumpman Mar 20 '17 at 21:53
  • CMake Error at CMakeLists.txt:13 (add_executable): add_executable called with incorrect number of arguments CMake Error at CMakeLists.txt:14 (target_link_libraries): Cannot specify link libraries for target "cvtask1a" which is not built by this project. – Jumpman Mar 20 '17 at 21:55
  • So you have moved `project()` call to the top, and original problem disappears. Problem with `add_executable()` is **unrelated** (in short: your `SOURCES` variable is empty). – Tsyvarev Mar 21 '17 at 09:20
  • 1
    Possible duplicate of [CMake on Linux: "target platform does not support dynamic linking"](http://stackoverflow.com/questions/12264299/cmake-on-linux-target-platform-does-not-support-dynamic-linking) – Tsyvarev Mar 21 '17 at 09:21
  • What should be in my sources var?? Anyway I was unable to find the file that guy suggested. I could only find it online in cmake repo... – Jumpman Mar 21 '17 at 10:07

0 Answers0