cmakelist: fix for cross-compilation #968
                
     Open
            
            
          
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
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:
to their relative alternatives fixes the issue for me.