Hello,

after speaking with Alex Neundorf I am asking here to reach more ppl.

My problem:
When I build a library foo and export it with install(EXPORT) etc. I will get a file called foo.cmake and foo-Debug.cmake which should be included when developing with my library foo. So if I now take the installed version of foo, tar it together into a package and unpack it somewhere else I will get a problem (on Windows). In the foo-Debug.cmake file the library foo itself is of course given relative to the foo-Debug.cmake file. 3rd party libraries are given with complete paths of my source computer though - which normally makes no sense on the destination computer. For now I am handling this with a post-install script but I would really like to have a different approach where cmake would make the 3rd-party-libraries paths' relative to the foo-Debug.cmake file as well.

Attached:
- the CMakeLists.txt file of my testing project - it simply builds one library, links it to Qt4 and exports its own library. - the exported file: you can see that in IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG you link to a complete path: "D:/cygopt/root/lib/QtCored4.lib" instead of "${_IMPORT_PREFIX}/lib/QtCored4.lib" as I would like it.

If you have any ideas, please simply tell me.

regards,
Patrick

--
web:                 http://windows.kde.org
mailing list:        [EMAIL PROTECTED]
irc:                 #kde-windows (irc.freenode.net)
project(myLib)
cmake_minimum_required(VERSION 2.6)

find_package(Qt4)
include_directories( ${QT_INCLUDES} )

add_library(mylibrary SHARED library.cpp)
target_link_libraries(mylibrary ${QT_QTCORE_LIBRARY})
target_link_libraries(mylibrary LINK_INTERFACE_LIBRARIES ${QT_QTCORE_LIBRARY})

install(TARGETS mylibrary EXPORT myLib
                          RUNTIME DESTINATION bin
                          LIBRARY DESTINATION lib
                          ARCHIVE DESTINATION lib)
install(EXPORT myLib DESTINATION lib)
#----------------------------------------------------------------
# Generated CMake target import file for configuration "Debug".
#----------------------------------------------------------------

# Commands may need to know the format version.
SET(CMAKE_IMPORT_FILE_VERSION 1)

# Compute the installation prefix relative to this file.
GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)

# Import target "mylibrary" for configuration "Debug"
SET_PROPERTY(TARGET mylibrary APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
SET_TARGET_PROPERTIES(mylibrary PROPERTIES
  IMPORTED_IMPLIB_DEBUG "${_IMPORT_PREFIX}/lib/mylibrary.lib"
  IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG "D:/cygopt/root/lib/QtCored4.lib"
  IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/bin/mylibrary.dll"
  )

# Cleanup temporary variables.
SET(_IMPORT_PREFIX)

# Commands beyond this point should not need to know the version.
SET(CMAKE_IMPORT_FILE_VERSION)
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to