[CMake] cmake 2.4.2 vs cmake 2.2.3

Brad King brad.king at kitware.com
Mon Jun 19 11:04:15 EDT 2006


Vikas Kumar wrote:
> Hi
> There is a difference in the way these two versions handle the
> installation part.
> Here is the snippet from the cmake_install.cmake file generated with
> cmake-2.4.2.
> 
> IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
>  SET(CMAKE_INSTALL_PREFIX "/home/vikas/installer/")
> ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)
> STRING(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX 
> "${CMAKE_INSTALL_PREFIX}")
> 
> 
> Why is the REGEX part replacing the last '/' character ? It is
> automatically generated by Cmake, so how do I prevent cmake from
> generating it ?
> This results in creation of directories named installerbin,
> installerlib instead of installer/bin and installer/lib. The above
> code worked fine in cmake-2.2.3

The install prefix should never have been set with a trailing slash. 
Your install rules should use leading slashes if you are using 
INSTALL_TARGETS, INSTALL_FILES, or INSTALL_PROGRAMS.  If you switch to 
using the INSTALL command in 2.4.2 (not compatible with 2.2 though), 
then you do not need a leading slash.

-Brad


More information about the CMake mailing list