[CMake] Installing: creating a command in a rule.
Brad King
brad.king at kitware.com
Wed Mar 1 09:09:52 EST 2006
Rodrigo Madera wrote:
> Forgive me if this is simple, but I've been in the documentation pages
> long enough...
>
> I have a library being built and in the installation I need to copy
> the generated library file along with the export of the subversion
> working directory.
>
> The library I copied with:
>
> INSTALL_TARGETS("" mylib)
>
> Right after the ADD_LIBRARY source file list.
>
> But now, where do I put the command I want executed in the install rule?
> Say the command is 'svn export abc xyz'. Where do I put it?
>
> I though of making an external install_export_things.cmake but I would
> really like to keep things organized and keep it in the CMakeLists.txt
> file. Anyone?
If you are using CMake 2.2 or earlier, read the documentation of the
SET_TARGET_PROPERTIES command. Use the POST_INSTALL_SCRIPT option. If
you're using CMake from CVS then look at the INSTALL command's SCRIPT
mode. Inside the CMake script use EXEC_PROGRAM (for 2.2 and earlier) or
EXECUTE_PROCESS (CVS version) to invoke the command.
In order to avoid creating a separate CMake script you could use the
FILE command's WRITE mode to write the CMake script from your
CMakeLists.txt file into the build tree. It could be packaged up inside
a macro.
-Brad
More information about the CMake
mailing list