[cmake-developers] FindGTest.cmake and CMP0064
David Chen
dchen at mail.nih.gov
Wed Nov 18 12:18:25 EST 2015
> Date: Wed, 18 Nov 2015 10:44:24 -0500
> From: Brad King <brad.king at kitware.com>
> To: cmake-developers at cmake.org
> Subject: Re: [cmake-developers] FindGTest.cmake and CMP0064
> Message-ID: <564C9CD8.9090900 at kitware.com>
> Content-Type: text/plain; charset=utf-8
>
> On 11/17/2015 11:37 AM, Rolf Eike Beer wrote:
>> Am 17.11.2015 17:08, schrieb David Chen:
>>> We?ve been getting a warning from FindGTest.cmake about CMP0064 when
>>> building SimpleITK. The warning occurs at lines 127, 129 and 131 when
>>> the variable ${test_type} is equal to ?TEST?. With CMP0064 this TEST
>>> could be interpreted as commands in the if() and elseif() statements
>>> unless the policy is set to OLD.
>
> With CMP0054 and CMP0064 both set to NEW then the original code
> would work as expected. However, CMake's modules must tolerate
> many policy (non-)setting combinations.
>
>> The correct fix would probably to just remove the dereference, i.e.
>> change
>>
>> if(${test_type} STREQUAL "TEST_P")
>>
>> to
>>
>> if(test_type STREQUAL "TEST_P")
>
> The code
>
> if(test_type STREQUAL "TEST")
>
> could still trigger CMP0064 warnings. We can use the style
>
> if("x${test_type}" STREQUAL "xTEST_P")
>
> to avoid both CMP0054 and CMP0064. Done here:
>
> FindGTest: Refactor test type checks to avoid cases triggering CMP0064
> https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b5e7b22d
>
> David, please verify that this approach still works for your case.
Your patch works fine for me.
Thanks,
Dave
David T. Chen, PhD [MSC contractor]
mailto:dchen at mail.nih.gov <mailto:dchen at mail.nih.gov> http://lhncbc.nlm.nih.gov/personnel/david-chen <http://lhncbc.nlm.nih.gov/personnel/david-chen>
phone:301.435.3264 <tel:301.435.3264> iphone:301.524.3174 <tel:301.524.3174>
Office of High Performance Computing and Communications
National Library of Medicine
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20151118/ed892892/attachment.html>
More information about the cmake-developers
mailing list