[CMake] set_target_properties not setting COMPILE_DEFINITIONS?

David Doria daviddoria at gmail.com
Tue Mar 29 19:04:39 EDT 2011


> An inspection of your CMakeLists.txt file [1] and the outputs
> of "make VERBOSE=1" [2,3] reveals the following goings-on:
>
> In [2], the lines 13 and 16 generate the object files
>
> CMakeFiles/Tech.dir/src/tech/Pch.cpp.o
> CMakeFiles/Tech.dir/src/tech/tech/Atomic.cpp.o
>
> and obviously, these are compiled for the target "Tech".
> The same holds for [3] in line 13 with the object file
>
> CMakeFiles/ImageCompleterLib.dir/src/image-completer-cmd/AppData.cpp.o
>
> belonging to the target "ImageCompleterLib".
>
> Now, in [1], you impose the COMPILE_DEFINITIONS property on the target
> "ImageCompleter1f" only, and of course, these definitions don't appear
> in compilation lines for targets other than the latter. So, impose the
> COMPILE_DEFINITIONS property on the other targets as well, and you'll
> probably see them appear in the compilation lines as desired.
>
> Regards,
>
> Michael
>
> [1] http://pastebin.com/SWZgmJ33
> [2] http://pastebin.com/zXaj9kWS
> [3] http://pastebin.com/X0t0L4Jv

Ahhh it all makes sense now. I'm very sorry, I didn't realize the Tech
files had been broken out into a separate static library. I was just
assuming I was doing something wrong with set_target_properties etc
since I had not used it before, but the problem was so obvious!

Thank you all very much for your help - at least I learned some good
debugging commands along the way.

David


More information about the CMake mailing list