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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

kent williams
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?

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.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: How do I set generated scripts executable in CMakeLists.txt?

Eric Noulard
2009/12/10 kent williams <[hidden email]>:
> 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
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: How do I set generated scripts executable in CMakeLists.txt?

Bill Lorensen
In reply to this post by kent williams
I believe the output file has the same permissions as the input file.
So if you make the input executable, the output will also be
executable.


On Thu, Dec 10, 2009 at 5:09 PM, kent williams
<[hidden email]> wrote:

> 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?
>
> 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.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake