[CMake] How do I set generated scripts executable in CMakeLists.txt?

Eric Noulard eric.noulard at gmail.com
Thu Dec 10 17:27:36 EST 2009


2009/12/10 kent williams <nkwmailinglists at gmail.com>:
> Say I generate a script using CONFIGURE_FILE.  How would I make it
> executable?  In other words, is there a CMake way of doing this that
> will work on all CMake platforms?

I don't think you can change permission in a portable manner at CMake time.

You may set permission using PERMISSIONS option of the
CMake INSTALL command (thus at install time),
however I guess you'd like to use
your generated scripts during build time and not after install time?

If you want to run your script at either CMake or build time using
execute_process and/or add_custom_command keep reading...

> The way we deal with portability in our particular case is to use Tcl
> scripts.  Our stuff won't work on any platform without tcl, so tclsh
> is the 'most portable' script processor.

If you know that your script in a tcl one AND you must run it at CMake
or build time then you can explicitely call

tcslh <yourscript>

if you do that you can do:

FIND_PACKAGE(Tclsh)

${TCL_TCLSH} should contain a valid tclsh interpreter.


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list