[CMake] INSTALL_PROGRAMS and shell scripts

Brad King brad.king at kitware.com
Tue Mar 1 11:57:00 EST 2005


Filipe Sousa wrote:
> Why this doesn't work? I would like to copy  
> ${CMAKE_CURRENT_BINARY_DIR}/GAL.sh to CMAKE_INSTALL_PREFIX/bin but cmake 
> insists in copying GAL.sh.in instead of GAL.sh
> 
> This is the code that generates the shell script file:
> 
> IF(UNIX)
>   CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/GAL.sh.in
>     ${CMAKE_CURRENT_BINARY_DIR}/GAL.sh @ONLY)
>   INSTALL_PROGRAMS(/bin GAL.sh)
> ENDIF(UNIX)

This is due to an ambiguity in the interface of INSTALL_PROGRAMS.  The 
documentation states that there are two forms of the command:

INSTALL_PROGRAMS(<dir> file file ...)
INSTALL_PROGRAMS(<dir> regexp)

Since you are giving only one argument CMake thinks it is the regexp 
version which only matches files in the source tree.  The GAL.sh.in is 
the first file to match the regex so it gets installed.  The work-around 
to this problem is

INSTALL_PROGRAMS(/bin GAL.sh GAL.sh)

This will install the file twice but at least it will work.  Meanwhile 
please submit a bug report here:

http://www.cmake.org/Bug

Thanks,
-Brad


More information about the CMake mailing list