[Piglit] [Patch v2 3/3] CMakeLists.txt: Use FindWaffle.cmake instead of pkg-find
Jose Fonseca
jfonseca at vmware.com
Mon Dec 15 11:42:39 PST 2014
On 15/12/14 19:36, Dylan Baker wrote:
> On Monday, December 15, 2014 07:23:10 PM Jose Fonseca wrote:
>>
>> On 15/12/14 18:56, Dylan Baker wrote:
>>> This is nice because it should work on both windows and on linux, since
>>> FindWaffle is provided by waffle itself.
>>>
>>> This is tested on Linux, but not on Windows.
>>>
>>> NOTE: There is a bug in FindWaffle.cmake that causes it to never check
>>> that the requested version is present. There is a patch on the waffle
>>> list for this problem.
>>>
>>> Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
>>> ---
>>> CMakeLists.txt | 26 +-------------------------
>>> 1 file changed, 1 insertion(+), 25 deletions(-)
>>>
>>> diff --git a/CMakeLists.txt b/CMakeLists.txt
>>> index e85bb37..200dbbf 100644
>>> --- a/CMakeLists.txt
>>> +++ b/CMakeLists.txt
>>> @@ -42,31 +42,7 @@ else()
>>> endif()
>>>
>>> if(PIGLIT_USE_WAFFLE)
>>> - if (NOT MSVC)
>>> - pkg_check_modules(WAFFLE REQUIRED waffle-1)
>>> -
>>> - if(NOT WAFFLE_FOUND)
>>> - message(FATAL_ERROR "Failed to find Waffle. If Waffle"
>>> - "is not packaged for your distribution, you can get "
>>> - "it at https://urldefense.proofpoint.com/v2/url?u=http-3A__www.waffle-2Dgl.org_&d=AAIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=SFYpmK_kSJY6st6hV0UPqYb0RyGi0hmhIs-w1r41SnA&s=igTNwzIfRoh2YlND544S4c0lbruOUka8htnMKhjGMcE&e= ."
>>> - )
>>> - endif()
>>> - endif ()
>>> -
>>> - # Check the installed waffle version.
>>> - #
>>> - # We cannot reliably check the version with pkg_check_modules(), but
>>> - # instead must check the version manually as below. The problem is that,
>>> - # if one passes a required version to pkg_check_modules(), CMake
>>> - # validates the required version at most once for the lifetime of the
>>> - # source tree. If someone changes the required version by editing the
>>> - # CMakeLists, CMake fails to detect the new requirement.
>>> - set(WAFFLE_REQUIRED_VERSION "1.3.0")
>>> - if(WAFFLE_VERSION VERSION_LESS WAFFLE_REQUIRED_VERSION)
>>> - message(FATAL_ERROR "Found waffle-${WAFFLE_VERSION}, but "
>>> - "piglit requires waffle-${WAFFLE_REQUIRED_VERSION}")
>>> - endif()
>>> -
>>> + find_package(Waffle, 1.3.0 REQUIRED)
>>> add_definitions(-DPIGLIT_USE_WAFFLE)
>>> add_definitions(-DWAFFLE_API_VERSION=0x0103)
>>> else()
>>>
>>
>> `pkg_check_modules(WAFFLE)` defines WAFFLE_INCLUDE_DIRS and WAFFLE_LDFLAGS
>>
>> But FindWaffle.cmake defines WAFFLE_INCLUDE_DIR & WAFFLE_LIBRARIES
>>
>> I'm surprised this works at all without renaming the variables everywhere.
>>
>>
>> The Windows instructions will need to be updated, mentining that
>> -DCMAKE_MODULE_PATH=/path/to/where/FindWaffle.cmake/can/be/found should
>> be passed on command line.
>>
>>
>> But otherwise I think it might be a good idea.
>>
>>
>> Jose
>
> Is there a system standard place to put cmake find modules on windows?
Not really. But don't worry. I'll propose a readme change after this
goes in.
> On linux this is installed in /usr/share/cmake/Modules which is in the
> cmake search path and is found automatically.
Jose
More information about the Piglit
mailing list