I use the following to copy some test files from one directory to
another:
SET (HDF5_REFERENCE_TEST_FILES
tnullspace.h5
family_v1.7_00003.h5
family_v1.7_00001.h5
mergemsg.h5
tbogus.h5
tbad_msg_count.h5
group_new.h5
deflate.h5
noencoder.h5
family_v1.7_00000.h5
le_extlink1.h5
tmtimeo.h5
tmtimen.h5
fill_old.h5
tlayouto.h5
family_v1.7_00002.h5
th5s.h5
tarrold.h5
)
FOREACH ( h5_file ${HDF5_REFERENCE_TEST_FILES} )
SET (dest "${PROJECT_BINARY_DIR}/${h5_file}")
MESSAGE(STATUS " Copying ${dest}")
ADD_CUSTOM_COMMAND (
TARGET ${HDF5_TEST_LIB_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different ${HDF5_TEST_DIR}/${h5_file} $
{dest}
)
ENDFOREACH ( h5_file ${HDF5_REFERENCE_TEST_FILES} )
Unfortunately it runs every time cmake is run but is still pretty
quick since after the first time it doesn't really copy anything.
_________________________________________________________
Mike Jackson mike.jack...@bluequartz.net
BlueQuartz Software www.bluequartz.net
Principal Software Engineer Dayton, Ohio
On Jan 30, 2009, at 8:00 AM, Jonatan Bijl wrote:
I have created an out-of-source build tree (on Windows), with the
installation directory as a subfolder of the build trees. The idea
is
that the compiled binary requires some DLL's, images, 3D models and
configuration files, at a location relative to the executable. If
the
files are changed, they will be copied from the source tree to the
installation tree again. Therefore, I need to run "make install all"
before running the executable. Because of the executable's
dependency on
the other files, I always want to build and install. (I don't expect
a
built file to work in itself because it won't be able to find the
required files)
In such a situation I usually try to "configure_file" things into the
build tree such that I can run the executable from the build tree.
Also setting EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH for this
purpose is very useful. If I need to configure some files differently
for the build and install tree, I configure them twice into separate
directories (the latter e.g. under ${CMAKE_BINARY_DIR}/InstallFiles).
This way I can have different versions of the configured files for
the
build and install tree.
I have now set up the tree so that the executables can be run
immediately from where they are created. I use configure_file to copy
the files. The problem is now, that every time I do a re-configure,
the
files (including a dll that is very big) are copied. Is there a way of
making sure the files are copied *only* when they are renewed? (and
also
making sure they are removed when the original is removed?)
Here is my layout of the project:
My setup is as follows:
Src //the root of the cmake project
+- Bin
| Main.cxx
+ Lib
| All other cxx and h files I made
+- Data
| Required files (3d models, images, etc.)
+- Cfg
Required config files
Debug //all contents over here is generated by cmake-gui ../src and
make
+- Bin
| Main.exe
| DLLs of 3rd party library
+- Lib
| Compiled libXXX.a files
+- Data
| Required files (3d models, images, etc.)
+- Cfg
Required config files
Thirdparty //this directory provides the 3rd party libraries we
link
| // against or include
+- Cxxtest
+- OgreSDK
+- Bin
| +- Debug
| | All the DLL's
| +- Release
| All the DLL's
+- Lib
Include
....
-------------------------------------------------------------
This e-mail is intended exclusively for the addressee. If you
are not the addressee you must not read, copy, use or
disclose the e-mail nor the content; please notify us
immediately [by clicking 'Reply'] and delete this e-mail.
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake