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

{cmake} FindLibuuid vs FindLibUUID #77

Open
asmaloney opened this issue Apr 3, 2023 · 8 comments
Open

{cmake} FindLibuuid vs FindLibUUID #77

asmaloney opened this issue Apr 3, 2023 · 8 comments

Comments

@asmaloney
Copy link

I'm replacing an older UUID lib with stduuid.

The old one used FindLibUUID in its cmake files and it worked fine on Debian with cmake and uuid-dev installed (GitLab CI).

When I switched my stuff to stduuid, it is using FindLibuuid (lowercase uuid) and now my CI fails:

CMake Error at lib/extern/stduuid/CMakeLists.txt:32 (find_package):
  By not providing "FindLibuuid.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Libuuid", but
  CMake did not find one.

  Could not find a package configuration file provided by "Libuuid" with any
  of the following names:

    LibuuidConfig.cmake
    libuuid-config.cmake

  Add the installation prefix of "Libuuid" to CMAKE_PREFIX_PATH or set
  "Libuuid_DIR" to a directory containing one of the above files.  If
  "Libuuid" provides a separate development package or SDK, be sure it has
  been installed.

Looking at CMake, they include FindLibUUID as a module which is what I assume was being found before.

Is there another package I need to install on Debian to get FindLibuuid to work?

@asmaloney
Copy link
Author

As a workaround I copied the FindLibUUID.cmake from CMake, changed the case to FindLibuuid (including vars), included it in my repo, and added it to CMAKE_MODULE_PATH.

Not ideal, but it works.

If anyone know the "right" way to find/include FindLibuuid, please let me know!

zzxzzk115 added a commit to zzxzzk115/stduuid that referenced this issue Apr 20, 2023
@zzxzzk115
Copy link

I found a solution:

sudo apt-get install uuid-dev

Then you can simply link the library by name uuid and the include path is usr/include/uuid/.

@mickeyze
Copy link

Then you can simply link the library by name uuid and the include path is usr/include/uuid/.

Can you please provide the code snippet?
Thanks

@asmaloney
Copy link
Author

Then you can simply link the library by name uuid and the include path is usr/include/uuid/.

This isn't actually fixing the problem - it's just removing FindLibuuid and hardcoding paths.

@zzxzzk115
Copy link

Then you can simply link the library by name uuid and the include path is usr/include/uuid/.

This isn't actually fixing the problem - it's just removing FindLibuuid and hardcoding paths.

Well, I totally agree. It's not a proper solution. Maybe I should detect which Linux distribution it runs on.

@frank2
Copy link

frank2 commented May 25, 2023

The solution I found to fix this problem is adding the following line before including stduuid in CMake:

list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/lib/stduuid/cmake")

After adding this line, stduuid was able to find the library just fine. I suspect Config.cmake.in isn't being executed in some configurations of using this library with CMake.

@frank2
Copy link

frank2 commented May 25, 2023

Am running into this issue with Debian too, FWIW. I'm not too familiar with the inner-workings of this project so I would feel uncomfortable submitting a PR for the CMake fix, but I believe just adding the modules to the module path will make FindLibuuid.cmake execute again.

@asmaloney
Copy link
Author

Thanks @frank2. That works. The included FindLibuuid.cmake seems a lot less robust than the one included with CMake. It does mean one less file to include in my lib though. 🤷

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

4 participants