[CMake] Adding a header dependency on a generated header file. (was PRE_BUILD custom commands don't appear to be working....)

Bill Lorensen bill.lorensen at gmail.com
Mon Dec 17 10:40:54 EST 2007


Josef,

Here's what I do. The fooCLP.h file is generated by a custom command.

      # mark the .clp file as a header file

SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/${TMP_FILENAME}CLP.h
PROPERTIES HEADER_FILE_ONLY TRUE)
      SET_SOURCE_FILES_PROPERTIES(${TMP_FILENAME}.cxx PROPERTIES
OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${TMP_FILENAME}CLP.h)

Bill

On Dec 17, 2007 9:53 AM, Josef Karthauser <joe.karthauser at geomerics.com>
wrote:

>  So, I've created a new target to generate the header, and made the
> library target depend upon it.  How do I now make sure that the generated
> header is considered in the dependency checks for the objects build from the
> CPP files that #include it?
>
>
>
> Joe
>
>
>
> *From:* David Cole [mailto:david.cole at kitware.com]
> *Sent:* 14 December 2007 18:18
> *To:* Bill Hoffman
> *Cc:* Josef Karthauser; cmake at cmake.org
> *Subject:* Re: [CMake] PRE_BUILD custom commands don't appear to be
> working....
>
>
>
> But you should be able to put your custom command in its own custom target
> and then use ADD_DEPENDENCIES to make the custom target build *before* any
> build steps for the library...
>
>
>
> Have you tried that?
>
>
>
>
>
> HTH,
>
> David
>
>
>
> On 12/14/07, *Bill Hoffman* <bill.hoffman at kitware.com> wrote:
>
> Josef Karthauser wrote:
> > I don't suppose anyone had any thought on this one did they?
> >
> >
> http://www.cmake.org/HTML/Documentation.html
>
> ADD_CUSTOM_COMMAND: Add a custom build rule to the generated build system.
> ....
> Note that the PRE_BUILD option is only supported on Visual Studio 7 or
> later. For all other generators PRE_BUILD will be treated as PRE_LINK.
> ....
>
>
> We have tried, and this is next to impossible to do with a makefile,
> sorry...
>
>
> -Bill
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
>
>
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20071217/d5bd1bd5/attachment-0001.htm


More information about the CMake mailing list