Hi,
I'm adding a custom command to run Lint on each source file, my initial
implementation created a phoney target "sourcefilename.lint" that depended on
the *source* file, this however means that Lint only gets run if the source
file changes, and not when any dependent headers change. (Note that I don't
want to add Lint as part of the compiler invocation line.)
To workaround this I made target "sourcefilename.lint" depend on the object
file, as CMake has already generated the header file dependencies for this.
This required knowing where the object file would be placed, but seemed to be
easy to predict:
ADD_CUSTOM_COMMAND( ...
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_libname}.dir/${_name}.obj
...
This was all working fine, until I've tried adding source file from a relative
directory, CMake now instead of using the predictable
"CMakeFiles/${_libname}.dir" for the object embeds a huge path based on the
relative source directory, e.g.
"CMakeFiles\sch.dir\V_\users\me\proj\common\host\sch".
I have two options to workaround this:
1) find a way of determine where the object file will be placed.
2) change the DEPENDS rule to depend on the source file *and* its header
dependencies.
Does anyone have any idea how to approach either of these or another method?
- TrevK
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake