On Monday 22 June 2009, pjtr hahn wrote: > 2009/6/22 Tyler Roscoe <[email protected]>: > > Are you sure it doesn't Just Work if you do it the straightforward way? > > Yes I am. I tried all combinations. > > If I add the phony_name AND the *.cpp as OUTPUT it will compile on > every run regardless if the .cpp has been touched by the command or > not. > If I only add the phony_name the *.cpp needs a second run to compile. > If I only add the *.cpp my custom command is only run once. > > > If it really doesn't, you could try generating your .cpp to somewhere > > out of the way and then do cmake -E copy_if_different to get it to the > > right place. This way, even if your rule updates your .cpp every time, > > it will be only be copied to the place where the compiler looks for it > > if it has changed. > > This is what I am actually doing in my script that is run by the > custom command. I leave the *.cpp untouched based on some external > condition even if the rule is executed at every build. > This is what I try to achive. Run the custom command at every build, > check some conditions and based on them update the *.cpp. If the > update condition is met and the file was touched then recompile. > > > But really I think it will just work if you add the relevant > > OUTPUT/DEPENDS parameters to your custom commands/targets. > > No. OUTPUT definitely doesn't work as expected. Adding the *.cpp to > OUTPUT causes a recompile on every run even if the file was untouched.
Please post an example which shows this issue. It should really work (and does here). Alex _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
