[CMake] [PATCH] Optionally skip link dependencies on shared library files
Brad King
brad.king at kitware.com
Fri Nov 9 09:52:41 EST 2012
On 10/26/2012 11:22 AM, Leif Walsh wrote:
> On Oct 26, 2012, at 11:13, Brad King <brad.king at kitware.com> wrote:
>
>> On 10/26/2012 10:39 AM, Leif Walsh wrote:
>>> Sure thing. Can you let me know where to find an example test? I'll pattern match one over the weekend.
>>
>> Most CMake tests just verify that binaries build correctly.
>> The "Tests/BuildDepends" test is the only one that actually
>> tests rebuild behavior. It has custom commands to build a
>> sub-project in its Project subdirectory multiple times while
>> making modifications in between.
>>
>> You'll have to modify the inner test project to add a shared
>> library and an executable that links to it. Set the new
>> property on the executable only. After the first build,
>> verify that the executable's time is newer than the library
>> time. Between builds, modify a the shared library source
>> (which of course will have to be in the build tree to avoid
>> modifying CMake's source tree). After the second build
>> verify that the library is newer than the executable.
>>
>> Checking the file times is probably most easily done as a
>> custom target on the inner project that depends on the
>> executable. Its COMMAND should run a cmake script and
>> pass -Dexe=$<TARGET_FILE:exe> -Dlib=$<TARGET_FILE:lib> to
>> it. The script can compare the ${lib} and ${exe} file
>> times with if(... FILE_IS_NEWER ...).
>
> Sounds good, I'll send a patch soon.
I finally had time to add this test myself:
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=306796e8
-Brad
More information about the CMake
mailing list