Emit deprecation warning on unscoped import target usage CMake will print the following warning: CMake Warning (dev) at CMakeLists.txt:n (target_link_libraries): The library that is being linked to, ceres, is marked as being deprecated by the owner. The message provided by the developer is: The unscoped import target `ceres' is deprecated and will be removed in a future Ceres Solver release. Please use the Ceres::ceres import target instead. This warning is for project developers. Use -Wno-dev to suppress it. Change-Id: I5abc875b1f61e1f47523375d1579a188047c45d4
diff --git a/cmake/CeresConfig.cmake.in b/cmake/CeresConfig.cmake.in index 9396d84..8b44612 100644 --- a/cmake/CeresConfig.cmake.in +++ b/cmake/CeresConfig.cmake.in
@@ -310,4 +310,10 @@ # true ALIAS library in CMake terms as they cannot point to imported targets. add_library(ceres INTERFACE IMPORTED) set_target_properties(ceres PROPERTIES INTERFACE_LINK_LIBRARIES Ceres::ceres) + + if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.17) + set_target_properties(ceres PROPERTIES DEPRECATION +"The unscoped import target `ceres' is deprecated and will be removed in a \ +future Ceres Solver release. Please use the Ceres::ceres import target instead.") + endif (CMAKE_VERSION VERSION_GREATER_EQUAL 3.17) endif()