Multiplatform frameworks

Alex Merry alex.merry at kde.org
Fri Feb 27 11:05:15 GMT 2015


On Wednesday 25 February 2015 19:10:08 Jeremy Whiting wrote:
> One issue I found however is that some frameworks (maybe all?) have a
> KF5FooConfig.cmake.in with ${PACKAGE_PREFIX_PATH}/@KDE_INSTALL_DATADIR@ in
> them to specify where to find the data files. On my OS X install that was
> getting filled in as "/usr/local/Users/jeremy/Library/Application Support"
> which is incorrect. It seems on linux KDE_INSTALL_DATADIR is a subpath of
> the prefix, but that doesn't work if we are installing data files outside
> the prefix. So how should/could this be solved? I can think of three ideas:
> 
> 1. Add another .cmake.in specifically for platforms that install data files
> outside the prefix such as KF5FooMacConfig.cmake.in which is used on OS X
> to generate the KF5FooConfig.cmake and doesn't include
> ${PACKAGE_PREFIX_PATH}

I'd rather avoid this approach - too easy to let the files get out of sync.

> 2. Inside KF5FooConfig.cmake.in have platform detection to define whether
> to use the prefix or not.

This is a lot of noise, and hard to check.

> 3. Use absolute paths for KDE_INSTALL_DATADIR everywhere and remove
> ${PACKAGE_PREFIX_PATH} completely.

There is KDE_INSTALL_FULL_DATADIR, which is absolute. However, that removes 
the relocatability of the package that ${PACKAGE_PREFIX_PATH} provides. I'm 
not sure just how much we care about that.

4. Use the PATH_VARS to ecm_configure_package_config_file().

ecm_configure_package_config_file() behaves like configure_package_config_file from 
CMake 3.0, so see 
http://www.cmake.org/cmake/help/v3.1/module/CMakePackageConfigHelpers.html

Basically, you add KDE_INSTALL_DATADIR to the PATH_VARS argument of 
ecm_configure_package_config_file(), and use @PACKAGE_KDE_INSTALL_DATADIR@ in 
your Config.cmake.in file, and it should all work.

Alex






More information about the kde-core-devel mailing list