[CMake] Dependency problem

Tyler Roscoe tyler at cryptio.net
Fri Jun 19 12:42:04 EDT 2009


On Fri, Jun 19, 2009 at 06:10:16PM +0200, pjtr hahn wrote:
> # generate source file
> add_custom_command( OUTPUT __phony_target_name
>      COMMAND some_command_to_generate
>      ARGS -o __my_outfile.cpp
>      ....
> )

Why don't you just do OUTPUT __my_outfile.cpp? That's what OUTPUT is for
-- to tell CMake which custom_command generates the file you need.

If you still have trouble with dependencies, do an add_custom_target()
that DEPENDS on __my_outfile.cpp, then add_dependendcies (__my_target
__custom_target).

> set_source_files_properties( __phony_target_name PROPERTIES SYMBOLIC TRUE )	
> 
> set_source_files_properties( __my_outfile.cpp PROPERTIES GENERATED TRUE )
> 
> set_source_files_properties( __my_outfile.cpp PROPERTIES
> OBJECT_DEPENDS ${__phony_target} )

What is ${__phony_target}? Is it just __phony_target_name?

What is that OBJECT_DEPENDS line trying to accomplish? I've never used
that property but I don't think it should be necessary here.

> add_executable( __my_target  __my_outfile.cpp  )

tyler


More information about the CMake mailing list