Alexander Neundorf wrote: > On Tuesday 14 February 2012, Yury G. Kudryashov wrote: >> will substitute @PACKAGE_INCLUDE_INSTALL_DIR@ by "../../../include" and >> @PACKAGE_MYPKGDATA_INSTALL_DIR@ by "../../../share/mypkg" (both >> transformed to be relative to DESTINATION). > > A problem I see here (and which we discussed already before on kde- > buildsystem) is the handling of the install() command. > > I thought a bit about a syntax like this, which I would like: > > configure_config_file(BarConfig.cmake.in BarConfig.cmake > INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} > PATH_VARS INCLUDE_INSTALL_DIR DATA_INSTALL_DIR > EXPORT_FILE BarExport.cmake) Why do you need EXPORT_FILE parameter? How can you use it? Include automatically? Then you need VERSION_FILE parameter as well.
> > but this can't work, can it ? > > In the BarConfig.cmake file there would still be either a > > set(BAR_INCLUDE_DIR "@INCLUDE_INSTALL_DIR@") > which would work for absolute paths, or a > > set(BAR_INCLUDE_DIR "${SomePrefix}/@INCLUDE_INSTALL_DIR@") > which would work only for relative paths, but a simple set() cannot work > for both cases. Am I missing something ? You'll have in BarConfig.cmake.in set(BAR_INCLUDE_DIR "@PACKAGE_HELPER_INCLUDE_INSTALL_DIR@) After configure_config_file() you'll have # At top get_filename_component(_PKG_CURRENT_DIR "${CURRENT_LIST_FILE}" PATH) get_filename_component(_PKG_PREFIX_PATH "${_PKG_CURRENT_DIR}/../../.." ABSOLUTE) #in place of your set() set(BAR_INCLUDE_DIR "${_PKG_PREFIX_PATH}/include") > > Do you have a working example ? Not yet. I think about something like this (not tested). foreach(var ${PACAKGE_HELPER_PATH_VARS}) if(NOT DEFINED ${var}) message(FATAL_ERROR ...) else if(IS_ABSOLUTE ${${var}}) file(RELATIVE_PATH PACKAGE_HELPER_${var} ${CMAKE_INSTALL_PREFIX} ${${var}}) else() set(PACKAGE_HELPER_${var} ${${var}}) endif() endforeach() It would be nice to make those PACKAGE_HELPER_* vars local to configure_config_file() function. -- Yury G. Kudryashov, mailto: ur...@mccme.ru -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers