cmakelist: fix for cross-compilation
When linking with freerdp3 in a Yocto build, I get:
| CMake Error at /home/marc/mnt/build/test-machine/tmp/work/zen2-eko-linux/freerdp3/3.17.2/recipe-sysroot/usr/lib/cmake/cJSON/cjson.cmake:85 (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 | | "/home/marc/mnt/build/test-machine/tmp/work/zen2-eko-linux/freerdp3/3.17.2/recipe-sysroot/usr/lib/cmake/cJSON/cjson.cmake" | | but not all the files it references. | | Call Stack (most recent call first): | /home/marc/mnt/build/test-machine/tmp/work/zen2-eko-linux/freerdp3/3.17.2/recipe-sysroot/usr/lib/cmake/cJSON/cJSONConfig.cmake:14 (include) | cmake/JsonDetect.cmake:12 (find_package) | winpr/libwinpr/CMakeLists.txt:19 (include) | | | -- Configuring incomplete, errors occurred!
The issue comes from the hard-coded "/usr/lib/libcjson.so.1.7.18" path. When cross-compiling, we link against the cross-compiled libraries from the sysroot and not from the local build machine.
Changing:
- CMAKE_INSTALL_FULL_LIBDIR
- CMAKE_INSTALL_FULL_INCLUDEDIR
- CMAKE_INSTALL_FULL_BINDIR
to their relative alternatives fixes the issue for me.