Re: [CMake] copy_if_different on build

2013-04-24 Thread Matthew Woehlke
On 2013-04-23 16:00, Skippy VonDrake wrote: Hmm... that is odd. I think there may be something else going on in your project that is not obvious from the above information. I wrote a quick example along the lines of what you show, and it worked fine for me. Actual CMakeLists.txt I used is attache

Re: [CMake] copy_if_different on build

2013-04-23 Thread Skippy VonDrake
> Hmm... that is odd. I think there may be something else going on in your > project that is not obvious from the above information. I wrote a quick > example along the lines of what you show, and it worked fine for me. Actual > CMakeLists.txt I used is attached. (The foo.c can contain any compilin

Re: [CMake] copy_if_different on build

2013-04-23 Thread Matthew Woehlke
Please keep this on list so that others may contribute/benefit. Thanks. On 2013-04-23 10:43, Skippy VonDrake wrote: Hmm... yes, I'm not sure if add_dependencies can be used to add a file dependency to a target (the documentation only talks about adding other targets as dependencies). Usually th

Re: [CMake] copy_if_different on build

2013-04-19 Thread Matthew Woehlke
On 2013-04-17 12:41, Skippy VonDrake wrote: Thought I understood this - but alas my implementation is wrong. Here's my test case with a top-level cmake file and 3 subdirectories: 'src', 'bin' and 'outdir'. Top level CMakeLists.txt cmake_minimum_required (VERSION 2.8) project (copyFile)

Re: [CMake] copy_if_different on build

2013-04-17 Thread Skippy VonDrake
> believe what you want is: > > add_custom_command( > OUTPUT "${output}" > DEPENDS "${input}" > COMMAND ${CMAKE_COMMAND} -E copy > "${input}" "${output}" > > ...which is roughly equivalent to a Makefile rule like: > > output: input > cp input output > > IOW, the file "${o

Re: [CMake] copy_if_different on build

2013-04-01 Thread Matthew Woehlke
On 2013-03-29 17:07, Skippy VonDrake wrote: I'll look closer at add_custom_command. I want the file to copy over if it has changed - at build time. Not cmake time. And not copy if it hasn't changed. But that may not be doable. Seems like every StackOverflow post I see has a different take on how

Re: [CMake] copy_if_different on build

2013-03-29 Thread Skippy VonDrake
>> I'm using: >>execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different >> ) >> >> Should the file be copied when: >> the file has changed AND a build is executed? >> Or >> the file has changed AND CMakeLists.txt has changed AND a build is >> executed? >> >> Only the 2nd m

Re: [CMake] copy_if_different on build

2013-03-29 Thread Matthew Woehlke
On 2013-03-29 15:15, Skippy VonDrake wrote: I'm using: execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ) Should the file be copied when: the file has changed AND a build is executed? Or the file has changed AND CMakeLists.txt has changed AND a build is executed?

[CMake] copy_if_different on build

2013-03-29 Thread Skippy VonDrake
I'm using: execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ) Should the file be copied when: the file has changed AND a build is executed? Or the file has changed AND CMakeLists.txt has changed AND a build is executed? Only the 2nd method (when the CMakeLists.txt file