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 attached. (The foo.c can contain any compiling
code, and foo.cfg.in can contain anything or even be empty.)

(Apparently a disadvantage of just using add_custom_target is that it always
runs, regardless of the DEPENDS. Not that this should be a huge problem,
though.)

Have you tried naming the input/output like
"${CMAKE_CURRENT_SOURCE_DIR}/name.in" and
"${CMAKE_CURRENT_BINARY_DIR}/name"? (I didn't do that in the attached
example because I was lazy (and the example may only work for in-source
builds as a result), but that is how I would recommend naming the files in a
real project.)

The source of my problem was 'naming'. I did use the CMake 'SOURCE_DIR'
variable but my file extensions were wrong and my path was off by one level!
Everything works fine now.

Ah, good to hear :-). Thanks for letting us know.

I did notice an effect I didn't expect - when
'make clean' is run the 'output' is deleted. Hadn't thought about that...

Well, yes, with the custom commend the output file is effectively a build artifact, so of course it is deleted by clean :-).

--
Matthew

--

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

Reply via email to