[CMake] Trouble exporting a library that is linked to Qt5 [SOLVED]

Alan W. Irwin irwin at beluga.phys.uvic.ca
Sat Apr 19 20:28:41 EDT 2014


On 2014-04-18 08:33-0700 Alan W. Irwin wrote:

> If not and you recommend instead we use an export config
> file for our two libraries that depend on Qt5, then I will make those
> changes.  But since the documentation that you reference in the URL
> above is quite complex and includes lots of stuff we currently don't
> use, then for the case where Qt5 is currently handled using
>
> find_package(Qt5Core 5.2.0)
> [...]
> add_library(plplot ${plplot_LIB_SRCS})
> [...]
> qt5_use_modules(plplot Svg Gui PrintSupport)
> [...]
> install(TARGETS plplot  EXPORT export_plplot ...)
> [...]
> install(EXPORT export_plplot DESTINATION ...)
>
> could you give a concrete example (that works for CMake 2.8.9 and
> above since 2.8.9 is our current minimum required version) of the
> minimum additions necessary to the above export procedure?

Hi Steve:

Never mind answering that question.  I have figured out how to do this for
myself.  I have created a plplotConfig.cmake file which contains:

___________
# Find Qt5 components that we need.
find_package(Qt5 5.2.0 COMPONENTS Svg Gui PrintSupport)

# Find export files in same directory location as present file.
include(${CMAKE_CURRENT_LIST_DIR}/export_plplot.cmake)
___________

where export_plplot.cmake is generated by the "install(EXPORT ...)"
command above.  Subsequent use of "find_package(plplot)" by external
projects now works fine for both the shared plplot library case (that
worked before) and the static plplot library case (that did not work
before).

Thanks for your essential help in getting this issue straightened out.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list