[CMake] not found library with package configuration files and changed CMAKE_INSTALL_PREFIX

Alexander Dahl post at lespocky.de
Mon Oct 10 06:07:30 EDT 2011


Hei hei, 

On Wed, 21 Sep 2011 16:42:37 +0200, Alexander Dahl wrote:
>> The foo-targets.cmake file contains "foo-shared" as imported target,
>> and it is this name that must be supplied to TARGET_LINK_LIBRARIES().
>> Besides, the DESTINATION clause of INSTALL() should be qualified with
>> ARCHIVE/LIBRARY/RUNTIME/..., and EXPORT must precede DESTINATION then.
> 
> Did that.

And it only works in Linux (Ubuntu Lucid 10.04 native with CMake 2.8.5
or cross compiling with ptxdist). On Windows XP with VS 2009 and CMake
2.8.5 the following happens:

install(TARGETS ${PROJECT_NAME}-shared EXPORT ${PROJECT_NAME}-targets
LIBRARY DESTINATION "lib")
#install(TARGETS ${PROJECT_NAME}-shared EXPORT ${PROJECT_NAME}-targets
DESTINATION "lib")
install(EXPORT ${PROJECT_NAME}-targets DESTINATION
"lib/cmake/${PROJECT_NAME}")

With the first line used it gives the following error:

CMake Error at src/CMakeLists.txt:19 (install):
  install Library TARGETS given no DESTINATION!

Commenting in the first line and using the second (removing the LIBRARY
keyword from the line) configure and build works. If someone wants to
reproduce: this is in my forked tree of the iniparser library, you could
get it from GitHub here: https://github.com/LeSpocky/iniparser/tree/work

Greets
Alex

-- 
»With the first link, the chain is forged. The first speech censured,
the first thought forbidden, the first freedom denied, chains us all
irrevocably.« (Jean-Luc Picard, quoting Judge Aaron Satie)
*** GnuPG-FP: 02C8 A590 7FE5 CA5F 3601  D1D5 8FBA 7744 CC87 10D0 ***


More information about the CMake mailing list