我有一个导出的库,现在想用find_package()
导入。如果我给出了FooConfig.cmake
文件的路径,那行得通。
cmake的配置步骤效果很好,但是在生成步骤中cmake抱怨
CMake Error in CMakeLists.txt:
Imported target "Foo" includes non-existent path
"Debug/include/Foo"
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.
因此在目标中仅存储了相对路径,这实际上很好,因为这样库的整个安装都是可重定位的。 在我看来,通过find_package导入库时,我需要设置安装前缀。有人知道怎么做吗?