[CMake] Installing files: modification dates, directory trees

Andy Cedilnik andy.cedilnik at kitware.com
Mon Mar 21 09:34:27 EST 2005


Hi David,

You can create cmake script that is run before or after installing
target, so you should be able to do whatever you want in it. So, you
could do something like:

IF(WIN32)
EXEC_PROGRAM("xcopy /p .....")
ELSE(WIN32)
EXEC_PROGRAM("cp -r ...")
ENDIF(WIN32)

That said, it is generally not a good idea to just copy the whole
directory. There can be files, directories, links, etc that you do not
want to copy. For example CVS or .svn directories. But if we would write
an install directory command, it would have to take at least a regular
expression or something of files to ignore.

I would say running a glob on directory and copy is not that hard. We do
it in several projects. This gives you full control over what to do. If
it becomes too tedious, you could always write a macro that does it.

       Andy

David Cole wrote:

> I would think that you could come up with some custom CMake
> EXEC_PROGRAM statements to copy directory trees that might be more
> maintainable than the multiple CMakeLists.txt files and SUBDIRs
> commands. It depends on the complexity of your directory structure and
> the number of target platforms you have to build on. You should be
> able to do an xcopy on Windows and its equivalent on Mac/Unix (cp ?)
> until such time as the "directory copy" feature can be added to CMake...
>
> Just a suggestion. Hope it helps,
>
> David
>
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake



-- 
Andy Cedilnik
Kitware Inc.



More information about the CMake mailing list