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

Use CMakePackageConfigHelpers to generate config.cmake #812

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zeerd
Copy link

@zeerd zeerd commented Dec 22, 2023

The current generated cJSONConfig.cmake holds hard coded path of libraries.
Use CMakePackageConfigHelpers and @PACKAGE_INIT@ to make them suit for realy environment dynamically.

@AndreaGreco
Copy link

Found same issue of @zeerd and reported in #837 by @aurelien-enchanted-tools

Thats error raised by OpenEmmbedded build-System:

| NOTE: Installed into sysroot: []
| NOTE: Skipping as already exists in sysroot: ['cjson', 'openssl', 'gettext-minimal-native', 'glibc', 'zlib', 'binutils-cross-aarch64', 'cmake-native', 'gcc-cross-aarch64', 'gcc-runtime', 'libgcc', 'libtool-native', 'm4-native', 'opkg-utils', 'quilt-native', 'libidn2', 'texinfo-dummy-native', 'linux-libc-headers', 'curl', 'libunistring', 'openssl-native', 'ncurses-native', 'zlib-native', 'flex-native', 'gnu-config-native', 'make-native', 'ninja-native', 'patch-native', 'perl-native', 'pseudo-native', 'bzip2-native', 'xz-native', 'zstd-native', 'attr-native', 'gdbm-native', 'gmp-native', 'libmpc-native', 'mpfr-native', 're2c-native', 'sqlite3-native']
| DEBUG: Python function extend_recipe_sysroot finished
| DEBUG: Executing shell function do_configure
| -- The C compiler identification is GNU 13.3.0
| -- The CXX compiler identification is GNU 13.3.0
| -- Detecting C compiler ABI info
| -- Detecting C compiler ABI info - done
| -- Check for working C compiler: /work/build-image/tmp-glibc/work/cortexa53-crypto-oe-linux/my-software-example/1.0/recipe-sysroot-native/usr/bin/aarch64-oe-linux/aarch64-oe-linux-gcc - skipped
| -- Detecting C compile features
| -- Detecting C compile features - done
| -- Detecting CXX compiler ABI info
| -- Detecting CXX compiler ABI info - done
| -- Check for working CXX compiler: /work/build-image/tmp-glibc/work/cortexa53-crypto-oe-linux/my-software-example/1.0/recipe-sysroot-native/usr/bin/aarch64-oe-linux/aarch64-oe-linux-g++ - skipped
| -- Detecting CXX compile features
| -- Detecting CXX compile features - done
| -- Found CURL: /work/build-image/tmp-glibc/work/cortexa53-crypto-oe-linux/my-software-example/1.0/recipe-sysroot/usr/lib/libcurl.so (found version "8.7.1")
| CMake Error at /work/build-image/tmp-glibc/work/cortexa53-crypto-oe-linux/my-software-example/1.0/recipe-sysroot/usr/lib/cmake/cJSON/cjson.cmake:86 (message):
|   The imported target "cjson" references the file
| 
|      "/usr/lib/libcjson.so.1.7.18"
| 
|   but this file does not exist.  Possible reasons include:
| 
|   * The file was deleted, renamed, or moved to another location.
| 
|   * An install or uninstall procedure did not complete successfully.
| 
|   * The installation package was faulty and contained
| 
|      "/work/build-image/tmp-glibc/work/cortexa53-crypto-oe-linux/my-software-example/1.0/recipe-sysroot/usr/lib/cmake/cJSON/cjson.cmake"
| 
|   but not all the files it references.
| 
| Call Stack (most recent call first):
|   /work/build-image/tmp-glibc/work/cortexa53-crypto-oe-linux/my-software-example/1.0/recipe-sysroot/usr/lib/cmake/cJSON/cJSONConfig.cmake:14 (include)
|   CMakeLists.txt:15 (find_package)
| 
| 
| -- Configuring incomplete, errors occurred!
| WARNING: exit code 1 from a shell command.

Seems that cmake try search in
/usr/lib/libcjson.so.1.7.18
instead of in
/work/build-image/tmp-glibc/work/cortexa53-crypto-oe-linux/my-software-example/1.0/recipe-sysroot/
Maybe because using CMAKE_INSTALL_FULL_* instead of CMAKE_INSTALL_*

Add to issue @kraj that is OpenEmmbedded maintainer of cJSON

Seems that @FSMaxB made first implementation of cJSONConfig.cmake.in and friends.
Is there some reason to use CMAKE_INSTALL_FULL instead of CMAKE_INSTALL

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.

3 participants