CMAKE_INSTALL_PREFIX doesn't work

Ralf Habacker ralf.habacker at freenet.de
Mon Jun 4 15:27:26 BST 2007


Andreas Pakulat schrieb:
> Hi,
>
> while creating the content for the new kdevplatform module I found that
> CMAKE_INSTALL_PREFIX doesn't work as expected. When setting
> CMAKE_INSTALL_PREFIX to /home/andreas/kdevplatform while running cmake:
>
> cmake -DCMAKE_INSTALL_PREFIX=/home/andreas/kdevplatform/
>
> the make install still installs most of the stuff into the kdelibs
> prefix, the cmake_install.cmake files all contain /home/andreas/kde4
> instead of /home/andreas/kdevplatform. Even after setting
> CMAKE_INSTALL_PREFIX to /home/andreas/kdevplatform before finding KDE4
> the issue persists.
>   
See in cmake_install.cmake. On win32 CMAKE_INSTALL_PREFIX is set in the
top of the file ...

# Set the install prefix
IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
  SET(CMAKE_INSTALL_PREFIX "C:/Programme/kdelibs")
ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)
STRING(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")


...but never used. Instead hardcoded pathes are used. This looks like an
issue of the install generator.

<snip>

FILE(INSTALL DESTINATION "C:/Programme/kdelibs/lib" TYPE STATIC_LIBRARY
OPTIONAL FILES "D:/daten/kdelibs-mingw-build/bin/libkdecore.dll.a")
FILE(INSTALL DESTINATION "C:/Programme/kdelibs/lib" TYPE SHARED_LIBRARY
FILES "D:/daten/kdelibs-mingw-build/bin/libkdecore.dll")
FILE(INSTALL DESTINATION "C:/Programme/kdelibs/bin" TYPE EXECUTABLE
FILES "D:/daten/kdelibs-mingw-build/bin/kde4-config.exe")
FILE(INSTALL DESTINATION "C:/Programme/kdelibs/lib/kde4" TYPE MODULE
FILES "D:/daten/kdelibs-mingw-build/bin/ktranscript.dll")
<snip>

Unfortunally this requires a fix in the cmake source. The relating code
could be found in  cmake source tree
cmake-2.4.6\Source\cmLocalGenerator.cxx(353):  fout << "# Set the
install prefix" << std::endl

The related part is located in
cmake-2.4.6\Source\cmLocalGenerator.cxx(2117) and following:

      // Compute the full install destination.  Note that converting
      // to unix slashes also removes any trailing slash.
      std::string destination = "${CMAKE_INSTALL_PREFIX}";
      destination += l->second.GetInstallPath();
      cmSystemTools::ConvertToUnixSlashes(destination);

I assume that "${CMAKE_INSTALL_PREFIX}" is replaced by the install
prefix at *configure* time, which results into the hardcoded path.

Ralf





More information about the kde-core-devel mailing list