Cmake add_custom_command is aways out of date?

First of all, you can put DEPENDS on GeneratorTool in your add_custom_command instead of main. Cpp . GeneratorTool already depends main.

Cpp .

Up vote 2 down vote favorite 1 share g+ share fb share tw.

I have the problem that add_custom_command is always out of date and therefore runs on every build. The custom command runs a tool that is a target of the same project to generate a file that is used by another target: add_executable(GeneratorTool main. Cpp) add_custom_command( OUTPUT generated.

H COMMAND GeneratorTool DEPENDS main. Cpp WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "** GeneratorTool **" ) add_library(MyLib STATIC generated. H ...) In the build output (visual studio 2010) I always see ** GeneratorTool **.

I would expect that it does not build again once generated. H exists and is newer than main.cpp. Any ideas?

Thanks, Jochen cmake link|improve this question edited Dec 20 '11 at 15:21 asked Dec 20 '11 at 13:14Jochen814.

First of all, you can put DEPENDS on GeneratorTool in your add_custom_command instead of main. Cpp . GeneratorTool already depends main.

Cpp . Then most likely it is the location of generated. H which is ambiguous which forces the rebuilt of generated.h.

Make sure that MyLib looks for the generated. H in the right place. My blind guess is to try: add_library(MyLib STATIC ${CMAKE_CURRENT_SOURCE_DIR}/generated.

H ...).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions