On Friday, April 24, 2015 12:33:50 Alan W. Irwin wrote: > The Fedora packager of PLplot is having trouble splitting installed > results into separate binary packages because of the way that PLplot > currently exports its targets. What steps do we have to do to make > life easier for him? > > Here is the typical code we use now to export our targets. > > # Done only once > install(EXPORT export_plplot DESTINATION ${LIB_DIR}/cmake/plplot) > > # Done for each different PLplot library target we want to export > install(TARGETS <targetname> > EXPORT export_plplot > ARCHIVE DESTINATION ${LIB_DIR} > LIBRARY DESTINATION ${LIB_DIR} > RUNTIME DESTINATION ${BIN_DIR} > ) > > # Done for each different PLplot executable target we want to export > install(TARGETS <targetname> > EXPORT export_plplot > DESTINATION ${BIN_DIR} > ) > > As a result of these commands, $prefix/lib/cmake/plplot contains > three files: > > export_plplot-noconfig.cmake, export_plplot.cmake, and plplotConfig.cmake > > I can find no reference to the noconfig variant, but from the > documentation, find_package(plplot) in Config mode will find > plplotConfig.cmake which in turn includes export_plplot.cmake which > has CMake logic that loops over _every_ exported target. > > For a completely separate build system (for our installed examples) > we import all these targets using > > find_package(plplot) > > and that works well for individual use of PLplot where nothing is > split out from the installation. > > However, that command does not work well for binary packagers of > PLplot since those packagers generally split the installed files into > a bunch of different binary packages (typically a core package and > optional additional packages to add extra features to the core > package). So if the Fedora packager, for example, splits out the > octave component of PLplot into a separate binary package, then when > that package is not installed, find_package(plplot) errors out (as a > result of that loop over all exported targets) with > > CMake Error at /usr/lib64/cmake/plplot/export_plplot.cmake:163 (message): > The imported target "plplot_octave" references the file > > "/usr/lib64/octave/site/oct/x86_64-redhat-linux-gnu/plplot_octave.oct" > > but this file does not exist. [...] > > What changes to the above export procedure and/or > find_package(plplot ... ) command are recommended so that > find_package(plplot ....) just works when some split PLplot > binary packages are not installed?
IIRC putting the targets which will end up in separate packages should be put into separate exports. To use everything later on using one find_package() call, you probably need one "umbrella" config file. Alex -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake