[cmake-developers] [New Module] FindOpenCL, FindHg

Rolf Eike Beer eike at sf-mail.de
Sat Feb 15 11:22:48 EST 2014


Matthäus G. Chajdas wrote:
> Hi Eike,
> 
> all right, then Hg, as it's FindHg, unless there is a naming policy I'm
> not aware of. I was just confused a bit due to FindGit, which uses GIT_
> as the prefix.
> 
> How do I proceed from here? What should I do next?

I think you can reduce FindHg quite a bit. Here are some examples:

-do not set Hg_FOUND to anything, FPHSA will do it for you
-/usr/bin is automatically searched
-if you do a REGEX REPLACE on the output anyway you do not need transfor the 
output toa list first. This should be roughly the same (untested):

REGEX REPLACE "^([^ ]*)\\+? .*" "\1"
REGEX REPLACE "^[^ ]* ([^ ]*)\\+?( .*)?" "\1"

Your indentation in both scripts looks a bit random, please chose one number 
of spaces (usually [2..4]) and use that everywhere.

When finding OpenCL you can create problems with environment variables 
containing \. If you use PATHS ENV INTELOCLSDKROOT CMake will handle that 
internally. You can set suffixes that CMake will search in any of the given 
directories. "include" should be automatically searched. If you need to 
process the paths yourself use file(TO_CMAKE_PATH). The OPENCL_LIB_SEARCH_PATH 
should be appended the Win32 stuff only if(WIN32), I don't think this path 
will be used e.g. on Linux.

The version check for OpenCL should come before FPHSA (just check for the 
include dir to be found), so one could call find_package(OpenCL 2.0) or 
something like that.

Eike
-- 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20140215/a724cc6a/attachment-0002.sig>


More information about the cmake-developers mailing list