cmake config-file imported target broken
After installing KTX-Software on macOS (probably elsewhere as well), both with the .pkg and cmake install, we have issues using the find_package functionality of cmake to use Ktx as imported target. Cmake states that the imported target includes a non-existent path.
CMake Error in CMakeLists.txt:
Imported target "KTX::ktx" includes non-existent path
"/usr/local/lib/basisu/transcoder"
in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:
* The path was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and references files it does not
provide.
In line 59 and 60 of the generated KtxTargets.cmake file indeed some of the listed paths don't exist on the filesystem after install.
56 set_target_properties(KTX::ktx PROPERTIES
57 INTERFACE_COMPILE_DEFINITIONS "\$<\$<CONFIG:Debug>:_DEBUG;DEBUG>;KTX_FEATURE_KTX1;KTX_FEATURE_KTX2"
58 INTERFACE_COMPILE_FEATURES "c_std_99;cxx_std_11"
59 INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/lib/basisu/transcoder;${_IMPORT_PREFIX}/other_include;${_IMPORT_PREFIX}/lib;${_IMPORT_PREFIX}/lib/basisu;${_IMPORT_PREFIX}/lib/dfdutils"
60 INTERFACE_LINK_LIBRARIES "/Users/mob/Developer/KTX-Software/other_lib/mac/Release/libzstd.a"
61 )
See the open pull request #325 for a potential fix
I believe PR #325 fixed this issue.
@UX3D-becher please tell us how to "(use) the find_package functionality of cmake to use Ktx as imported target". I am not familiar with this. Please make a PR to add the information to README.md or, if that is not possible, please explain here. I have other users saying they are having problems using KTX as a cmake dependency and I want to help them. See issue #205.