[CMake] RE: CMake 2.4.1/VC71 Why the wierd <project>.dir subdirs?

Bill Hoffman bill.hoffman at kitware.com
Thu May 10 15:18:59 EDT 2007


Trevor Kellaway wrote:
>
> Does that mean this is supported in the dev tree?
>
> I tried this with "cmake version 2.5-20070505" but it didn't work, I
> also tried
>
> 	GET_TARGET_PROPERTY (myobj myfile.c OBJECT_FILES)
>
> What I really want to do is determine the object file for a specific
> source file, mainly so I can create a target that depends on the object
> file as this will already have all the C and H dependencies.
>
> The alternative is to try and dump the dependency information for a
> source file (recommendations on how appreciated) and then use this to
> set dependency.
>
>   
It should work like this:

add_executable(foo foo.cxx)
get_target_property(objs foo OBJECT_FILES)
message(${objs})

There is no option for a specific obj file, but you could search objs 
for the one you want.

-Bill



More information about the CMake mailing list