[CMake] CMake copy files when they change to build dir

Eric Jonas jonas at MIT.EDU
Fri Aug 7 10:08:16 EDT 2009


Hello, 

I use CMake with boost::python to generate python modules, and it does a
great job of creating the required .so files. There's an interesting
question, however, of how to test the resulting object. When doing an
out-of-source build, I end up with 

build/myproj/foo.so

and in my source tree I have

src/myproj/test_foo.py

I'd like to, as part of the build process, copy  test_foo.py
to build/myproj/test_foo.py . That is, when I type "make", if
src/myproj/test_foo.py differs from build/myproj/test_foo.py, copy it
over. 

I've tried various incantations of add_custom_command but haven't been
able to figure out the right thing to do. It seems like somehow
I want the underlying generated Makefile to contain the relevant "cp"
command, but thus far I have been unsuccessful. 

Thanks for any help you can provide, 
			...Eric






More information about the CMake mailing list