Setting paths which depend on CMAKE_INSTALL_PREFIX

David Jarvie djarvie at kde.org
Fri Jun 5 00:49:14 CEST 2009


I'm creating a separate package for KAlarm, and want to default its 
installation path to the KDE installation directory. In CMakeLists.txt I've 
got:

find_package(KDE4 4.1.0 REQUIRED)
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
   set(CMAKE_INSTALL_PREFIX "${KDE4_INSTALL_DIR}" CACHE PATH "Install prefix")
endif (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)

According to what I've read on this mailing list, this ought to set all the 
other KDE install paths used by cmake to use the new value of 
CMAKE_INSTALL_PREFIX also. However, it actually installs into /usr/local 
instead (which is not where my KDE is installed). I seem to have to add the 
following definitions (copied from FindKDE4Internal.cmake with appropriate 
amendments) after the 'set' above to make it work:

set(EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE PATH "Base directory 
for executables and libraries")
#   set(BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" CACHE PATH "The install 
dir for executables")
#   set(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE PATH 
"The subdirectory relative to the install prefix where libraries will be 
installed")
...etc.

Is there any way to set all the install paths to use the new definition of 
CMAKE_INSTALL_PREFIX automatically, without having to define each one like 
this?

-- 
David Jarvie.
KAlarm author and maintainer.
http://www.astrojar.org.uk/kalarm


More information about the Kde-buildsystem mailing list