[CMake] Problems to get one target installed at several places

Stefan Granqvist grankis at msn.com
Fri Jan 14 03:38:26 EST 2005


Hi,

I am currently using CMake 2.0.3 on a Solaris platform. I would like to 
install the same target at several places in the installation tree, by using 
several INSTALL_TARGET commands, e.g.
  INSTALL_TARGET(/usr/bin myprogram)
  INSTALL_TARGET(/usr/local/bin myprogram)

This does not work, only the last written command is executed by "make 
install". I have also tries INSTALL_FILES and INSTALL_PROGRAMS. 
INSTALL_FILES does the job to install at several places but clears the 
execution flags in the file protection bits for the installed files. 
INSTALL_PROGRAMS on the other hand, indeed can handle multiple install 
places and sets the execution bits.

However, when using INSTALL_PROGRAMS I have to include the full path to the 
binary file to install because the binary is not build into the 
PROJECT_SOURCE_DIR. If that path includes anything that can be treated as a 
regular expression character, a command like
INSTALL_PROGRAMS(/usr/local/bin ../bin/myprogram) causes nothing to be 
installed, because it is interpreted as a reg-exp variant of 
INSTALL_PROGRAMS.

Indeed I can fool the command to be interpreted as non-rexexp by listing two 
programs to be installed. I can get what I want by writing something like
  INSTALL_PROGRAMS(/usr/local/bin ../bin/myprogram ../bin/myprogram)
  INSTALL_PROGRAMS(/usrl/bin ../bin/myprogram ../bin/myprogram)

Well, that works but it is ugly to install everything twice.


Does anyone have any clues to get this to work nicely? One can argue that a 
target indeed only should be installed in one place, but I have a legacy 
situation when I am adapting CMake to produce the same result as an old 
makefile-based system which creates a install structure with several install 
locations the same target. Can the non-documented restriction of 
INSTALL_TARGET be removed/corrected in some future release?

/Stefan

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



More information about the CMake mailing list