[CMake] VS.NET 2003 Generator issue...

Lars Pechan lars.pechan at parkerpechan.com
Thu Apr 14 01:45:50 EDT 2005


Hi again,
Another question: I have a large CMake project. I'm doing out of source 
builds but because some files are used in several places with slightly 
different compiler settings I copy them to the build-side and build 
them in the appropriate directory.

I do this with some custom commands along the lines of:

SET(wnsources  file.c data.c utl.c dbg.c mem.c)

FOREACH(fn ${wnsources})
   ADD_CUSTOM_COMMAND(
     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${fn}
     COMMAND ${CMAKE_COMMAND}
     ARGS -E copy ${wnsrcdir}/${fn} ${CMAKE_CURRENT_BINARY_DIR}/${fn}
     MAIN_DEPENDENCY(${wnsrcdir}/${fn})
   )
ENDFOREACH(fn ${wnsources})

I use this approach quite frequently and it works very well for NMake 
Makefiles as well as Unix Makefiles but when I generate for VS.NET 2003 
the file named data.c is _never_ copied. It exists in the tree in the 
destination location but trying to open it gives a"The system cannot 
find the file specified.". In fact, no CMake Rule is even created for 
it. The other 200 files I copy using exactly this technique copy fine. 
Even the other files in ${wnsources} come across, just not bloody 
data.c??

Any ideas?

Regards,

/Lars



More information about the CMake mailing list