Skip to content

Generating OrbbecSDKConfigVersion.cmake file#107

Closed
matlabbe wants to merge 2 commits intoorbbec:mainfrom
matlabbe:adding_config_version
Closed

Generating OrbbecSDKConfigVersion.cmake file#107
matlabbe wants to merge 2 commits intoorbbec:mainfrom
matlabbe:adding_config_version

Conversation

@matlabbe
Copy link
Copy Markdown
Contributor

@matlabbe matlabbe commented Oct 7, 2025

Summary

The PR adds cmake code to generate a standard OrbbecSDKConfigVersion.cmake, useful when requesting a specific package version from downstream projects including the library with cmake: find_package(OrbbecSDK 2 REQUIRED). Because the OrbbecSDK v1 library shares exactly the same package name, the only way downstream to differentiate the versions with cmake is by using the standard approach as above.

Current issue that this PR solves

If in a downstream project we do:

find_package(OrbbecSDK)

We may end up with either OrbbecSDK v1 or OrbbecSDK v2 target, if both are installed at the same time.

If we do instead:

find_package(OrbbecSDK 2 REQUIRED)

we would get error like this (even if OrbbecSDK v2 is installed):

$ cmake -DOrbbecSDK_DIR=/opt/OrbbecSDK/lib ..

CMake Error at CMakeLists.txt:703 (FIND_PACKAGE):
  Could not find a configuration file for package "OrbbecSDK" that is
  compatible with requested version "2".

  The following configuration files were considered but not accepted:

    /opt/OrbbecSDK/lib/OrbbecSDKConfig.cmake, version: unknown

Results with this PR

With:

find_package(OrbbecSDK 2 REQUIRED)
message(STATUS "Found OrbbecSDK ${OrbbecSDK_VERSION}")

we then get:

$ cmake -DOrbbecSDK_DIR=/opt/OrbbecSDK/lib ..

...
-- Found OrbbecSDK 2.4.11
...

@simbachou
Copy link
Copy Markdown
Contributor

Thanks for your contribution!
This PR has been merged into our internal develop branch and will appear in a future public sync.

@simbachou simbachou closed this Oct 14, 2025
@matlabbe matlabbe deleted the adding_config_version branch October 14, 2025 01:31
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

Successfully merging this pull request may close these issues.

2 participants