When I try to import a library using
add_library(libname SHARED IMPORTED)
set_property(TARGET libname PROPERTY IMPORTED_LOCATION /<foldername>/<sub-foldername>/lib")
The cmake shouts :
CMake Warning (dev) at /CMakeLists.txt:28 (target_link_libraries): Cannot specify link libraries for target "libname" which is not built by this project.
CMake does not support this but it used to work accidentally and is being allowed for compatibility.
Policy CMP0016 is not set: target_link_libraries() reports error if only argument is not a target. Run "cmake --help-policy CMP0016" for policy details. Use the cmake_policy command to set the policy and suppress this warning. This warning is for project developers. Use -Wno-dev to suppress it.
If this is true, what is the other best way to include a library somewhere in my build tree into another project. I have a library setup and another place has executable which will be using the libraries. Reading through the cmake documentation, it felt like this would be the best way forward but seems its a broken piece which is just being supported.