admin管理员组

文章数量:1635849

(http://stackoverflow/questions/14990343/cmake-error-targets-given-no-library-destination-for-shared-library-target)

CMake Error: TARGETS given no LIBRARY DESTINATION for shared library target

Ask Question
up vote 17 down vote favorite 3

When building an opensource project with CMake (in my case, it was the lemon graph library), I got this error when I tried to build shared libaries via -DBUILD_SHARED_LIBS=1:

TARGETS given no LIBRARY DESTINATION for shared library target

Where does this error come from and how do I fix it?

cmake lemon-graph-library
share improve this question edited Jun 22 '14 at 7:54 Artem Zankovich 1,945 15 31 asked Feb 20 '13 at 21:32 Stuart Berg 5,531 6 24 56
  add a comment

2 Answers

active oldest votes
up vote 24 down vote

I got this error because the project had a CMakeLists.txt file that needed fixing. A call to the cmake INSTALL command had an ARCHIVE parameter, but no LIBRARY parameter. In my case, I wanted the libraries placed in 'lib', so changing this:

INSTALL(
  TARGETS lemon
  ARCHIVE DESTINATION lib
  COMPONENT library
)

to this:

INSTALL(
  TARGETS lemon
  ARCHIVE DESTINATION lib
  LIBRARY DESTINATION lib
  COMPONENT library
)

fixed my problem.

本文标签: TARGETSLibraryCMAKEError