cmake problem on win32

Alexander Neundorf neundorf at kde.org
Wed Oct 22 22:08:51 CEST 2008


On Wednesday 22 October 2008, Christian Ehrlicher wrote:
> Andreas Pakulat schrieb:
> > On 21.10.08 22:48:39, Andreas Pakulat wrote:
> >> Hi,
> >>
> >> I've got a small problem here with using INCLUDE_INSTALL_DIR during
> >> cmake time. It seems as if that variable is set to "include" instead of
> >> an absolute path. This causes a problem with kdevplatform, because that
> >> variable is used to write a KDevPlatformConfig.cmake with the right
> >> include-dir.
> >>
> >> This file now ends up with
> >>
> >> set(KDevPlatform_INCLUDE_DIR "include/kdevplatform")
> >>
> >> which of course doesn't work.
> >>
> >> Everything is fine on linux, it only breaks on windows.
> >>
> >> KDevPlatformConfig.cmake.in looks like this:
> >>
> >> set(KDevPlatform_INCLUDE_DIR "@INCLUDE_INSTALL_DIR@/kdevplatform")


> > Apparently the reason is FindKDE4Internal.cmake. On Win32 it sets the
> > variable to just "include", while on other platforms it also prepends
> > CMAKE_INSTALL_PREFIX. This seems to happen for all other variables set
> > there as well, is this intentional? Can it be changed to be the same on
> > all platforms? I'd like to avoid the extra check in KDevPlatform if
> > possible.
>
> Where does INCLUDE_INSTALL_DIR come from? You can't know where the user
> installs your app in the end so using INCLUDE_INSTALL_DIR on windows
> isn't a good idea at all.

Yes.
The FOO_INSTALL_DIR variables are the install destination of the current 
project, they don't have to match with anything else already installed.

KDE4_LIB_DIR and KDE4_INCLUDE_DIR are the locations where kdelibs has been 
installed to and are determined by FindKDE4Internal.cmake (FOO_INSTALL_DIR 
are just initialized by FindKDE4Internal.cmake, (basically) independent from 
any already installed things).

So the code above is actually correct (except the relative directory).
For a project _using_ KDevPlatform KDevPlatform_INCLUDE_DIR will be what 
INCLUDE_INSTALL_DIR was while building KDevPlatform.

On Windows FOO_INSTALL_DIR are relative directories because of what Christian 
said, the user can install them anywhere. I think it was Ralph who was 
working on this.
Have a look at kdelibs/CreateKDELibsDependenciesFile.cmake.
There is a macro MAKE_INSTALL_PATH_ABSOLUTE(), which converts relative paths 
to absolute ones. Not really. it prefixes them with the _variable_ 
KDE4_INSTALL_DIR (note that the $ is escaped). Then KDE4_INSTALL_DIR is set 
like this:
if (NOT KDE4_INSTALL_DIR)
   set(KDE4_INSTALL_DIR         \"${CMAKE_INSTALL_PREFIX}\")
endif (NOT KDE4_INSTALL_DIR)

I.e. the install locations are still somewhat flexible (but it doesn't seem 
completely finished yet).
I guess you want to do something similar for KDevPlatform.

I hope this wasn't too confusing.

Alex




More information about the Kde-windows mailing list