Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenCL_INCLUDE_DIRS and OpenCL_LIBRARIES are not set. #85

Open
pjueon opened this issue Sep 26, 2023 · 1 comment
Open

OpenCL_INCLUDE_DIRS and OpenCL_LIBRARIES are not set. #85

pjueon opened this issue Sep 26, 2023 · 1 comment
Assignees

Comments

@pjueon
Copy link

pjueon commented Sep 26, 2023

Hello, I'm currently building and testing the OpenCL-SDK, and I have a question.

First, I built and installed the OpenCL-SDK using CMake. Then, in another CMake project, I called find_package(OpenCL REQUIRED) to use OpenCL.

The OpenCL_FOUND variable is set to 1, and I can successfully build it by calling target_link_libraries(MyProject OpenCL::OpenCL). However, the OpenCL_INCLUDE_DIRS and OpenCL_LIBRARIES variables are not being set and are empty.

As far as I know, when find_package succeeds, it's a standard CMake practice for <PackageName>_INCLUDE_DIRS and <PackageName>_LIBRARIES variables to be set. I might be wrong since I'm not very familiar with CMake, but I believe this is the typical behavior in CMake.

I'm building other projects that use OpenCL, such as clFFT. In these projects, they directly reference the OpenCL_INCLUDE_DIRS and OpenCL_LIBRARIES variables in their CMakeLists.txt to build. Of course, I could modify the CMakeLists.txt files of these projects to call target_link_libraries(SomeProject OpenCL::OpenCL) directly, but it would be more convenient if <PackageName>_INCLUDE_DIRS and <PackageName>_LIBRARIES variables were automatically set when find_package succeeds. This would make it easier to work with a variety of projects.

If I'm mistaken about something, please let me know. Thanks.

@MathiasMagnus
Copy link
Collaborator

MathiasMagnus commented Nov 21, 2023

Hi @pjueon, do I understand correctly that you'd like the old-school style variables be set when a user specifically opts in to detecting the OpenCL SDK in Config mode? The Module mode of find_package unfortunately by defaults hides the package config file and only triggers if the scripts opt-in using the CONFIG flag or the user overrides the default via CMAKE_FIND_PACKAGE_PREFER_CONFIG globally.

It has not occured to me someone would want to mix'n'match features this way because Module mode finds this SDK just as well, there are no additional targets or libraries exposed via these variables, IMHO it would be erronous to expect the utility libraries to appear as part of there variables. So long as its installed in a system default location or the user points to it using one of the ways listed in Config Mode Search Procedure, it should work. Let me know if this is what you meant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants