List:Commits« Previous MessageNext Message »
From:Joerg Bruehe Date:January 22 2011 11:08am
Subject:Re: bzr commit into mysql-5.5-bugteam branch (joerg:3209) Bug#42969
View as plain text  
Hi Vlad,


thank you very much for looking at my patch and commenting.

Vladislav Vaintroub wrote:
> Hi Joerg,
> 
>> -----Original Message-----
>> From: Joerg Bruehe [mailto:joerg@stripped]
>> Sent: Freitag, 21. Januar 2011 21:40
>> To: commits@stripped
>> Subject: bzr commit into mysql-5.5-bugteam branch (joerg:3209) Bug#42969
> 
> 
>> +ADD_CUSTOM_TARGET(VERSION_BIN ALL
>> +  COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/version_files.cmake
>> +  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
>> +)
> 
> A problem with ADD_CUSTOM_TARGET when it is used like this is that it is always
> rebuilt (there are no inputs and not outputs , so it
> is always considered out-of-date). However there is a way to make it work more like
> classic make utility with input and output,
> where rebuild is done only if input changes.

Yes, I am aware of it being rebuilt every time. While that is considered
waste of cycles in a typical compilation, I in fact favor it here:

- Creating that file should be little effort, so it should not increase
  the build time in any noticeable way.

- If we extend the rule for "VERSION_bin" by looking at further files,
  we would need to extend the dependencies in your approach. As written
  above, this has proved to be difficult.

- The brute force approach "do it always" ensures that even manual
  interventions which change any of the prerequisite files (like
  "flags.cmake") will be reflected in "VERSION_bin".

- "VERSION_bin" also contains a timestamp, IMO that should be that of
  the (last) "make" run.

> 
> How about something like:
> 
> ADD_CUSTOM_COMMAND(
>    OUTPUT ${CMAKE_BINARY_DIR}/VERSION_bin
>    COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/version_files.cmake
>    DEPENDS ${CMAKE_BINARY_DIR}/CMakeCache.txt
>   )
> 
> ADD_CUSTOM_TARGET(VERSION_BIN  ALL  
>   DEPENDS ${CMAKE_BINARY_DIR}/VERSION_bin)
> 
> Disclaimer: I have not tried that with your patch :)   just took the technique from
> the Cmake FAQ (
> http://www.cmake.org/Wiki/CMake_FAQ , section "How do I generate an executable, then
> use the executable to generate a file? " ) and
> applied to your example (your example is simpler, because you do not have to generate
> an executable).   I assumed you generate the
> VERSION_bin from CMakeCache.txt and there are no other dependencies , at least it
> seems so to me.

Well, the other dependency is "sql/CMakeFiles/sql.dir/flags.make", and I
wouldn't be surprised if we in the future add information which must be
collected from other files.

Sadly, I have found the cmake documentation to disagree from the acctual
behavior:
While "http://www.cmake.org/cmake/help/cmake2.6docs.html" mentions
several interesting "CMAKE_{HOST_}SYSTEM*" variables, they were not
provided in my tests (cmake 2.6.0, Debian "stable").

Also, I had trouble with rules that used files (like "flags.make" and
"CMakeCache.txt") which were created only at the end of the cmake phase.
That is also the reason why several of my new actions are guarded by an
"IF(EXISTS ...)".
Maybe this can be solved by explicitly adding information these files
will be generated, but all in all cmake seems to do some existence and
dependency checks which I had expected in the make phase only.

Because of this, I'm reluctant to do more complicated cmake constructs,
and rather favor a "keep it simple" approach. I know it isn't elegant.


However, I very much appreciate your comments and thoughts!

Regards,
Jörg

-- 
Joerg Bruehe,  MySQL Build Team,  joerg.bruehe@stripped
               (+49 30) 417 01 487
ORACLE Deutschland B.V. & Co. KG,   Komturstrasse 18a,   D-12099 Berlin
Geschaeftsfuehrer: Juergen Kunz, Marcel v.d. Molen, Alexander v.d. Ven
Amtsgericht Muenchen: HRA 95603

Thread
bzr commit into mysql-5.5-bugteam branch (joerg:3209) Bug#42969Joerg Bruehe21 Jan
  • RE: bzr commit into mysql-5.5-bugteam branch (joerg:3209) Bug#42969Vladislav Vaintroub21 Jan
    • Re: bzr commit into mysql-5.5-bugteam branch (joerg:3209) Bug#42969Joerg Bruehe22 Jan
      • RE: bzr commit into mysql-5.5-bugteam branch (joerg:3209) Bug#42969Vladislav Vaintroub22 Jan
        • RE: bzr commit into mysql-5.5-bugteam branch (joerg:3209) Bug#42969Vladislav Vaintroub22 Jan
          • Re: bzr commit into mysql-5.5-bugteam branch (joerg:3209) Bug#42969Joerg Bruehe31 Jan
            • RE: bzr commit into mysql-5.5-bugteam branch (joerg:3209) Bug#42969Vladislav Vaintroub31 Jan
              • Re: bzr commit into mysql-5.5-bugteam branch (joerg:3209) Bug#42969Joerg Bruehe31 Jan
        • Re: bzr commit into mysql-5.5-bugteam branch (joerg:3209) Bug#42969Joerg Bruehe25 Jan
          • Re: bzr commit into mysql-5.5-bugteam branch (joerg:3209) Bug#42969Joerg Bruehe26 Jan
          • RE: bzr commit into mysql-5.5-bugteam branch (joerg:3209) Bug#42969Vladislav Vaintroub26 Jan