[cmake-developers] CMake 3.0 find_patch changes?

"Matthäus G. Chajdas" cmake at anteru.net
Tue Jun 17 14:21:02 EDT 2014


Hi,

I've just tried my FindOpenCL Module in cmake-next, and with 3.0, it
doesn't work as expected (on Windows)

Before I submit the fix, I wanted to check back that I was indeed doing
it wrong before.

In my find_path, I used the following call:

find_path(OpenCL_INCLUDE_DIR
  NAMES
    CL/cl.h OpenCL/cl.h
  PATHS ENV
    "PROGRAMFILES(X86)"
    AMDAPPSDKROOT
    INTELOCLSDKROOT
    NVSDKCOMPUTE_ROOT
    CUDA_PATH
    ATISTREAMSDKROOT
  PATH_SUFFIXES
    OpenCL/common/inc
    "AMD APP/include")

which I had to change to

find_path(OpenCL_INCLUDE_DIR
  NAMES
    CL/cl.h OpenCL/cl.h
  PATHS
    ENV "PROGRAMFILES(X86)"
    ENV AMDAPPSDKROOT
    ENV INTELOCLSDKROOT
    ENV NVSDKCOMPUTE_ROOT
    ENV CUDA_PATH
    ENV ATISTREAMSDKROOT
  PATH_SUFFIXES
    include
    OpenCL/common/inc
    "AMD APP/include")

Notice that I have to repeat ENV now for every environment variable, and
I had to add "include" to PATH_SUFFIXES. Without repeating ENV, only the
first environment variable is expanded. However, I cannot find anything
in the CMake 3.0.0 release notes regarding find_path which would explain
why these changes are necessary, and this code used to work with CMake
2.8.12. Is this a regression, or was I simply lucky that it worked?

Cheers,
  Matthäus


More information about the cmake-developers mailing list