From 7d196b4e6a71eb6e6bdde27216c5caabd6dbc208 Mon Sep 17 00:00:00 2001 From: Sergiu Deitsch Date: Mon, 17 Feb 2025 20:37:19 +0100 Subject: [PATCH] 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 --- cmake/CeresConfig.cmake.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmake/CeresConfig.cmake.in b/cmake/CeresConfig.cmake.in index 9396d84e6..8b44612f9 100644 --- a/cmake/CeresConfig.cmake.in +++ b/cmake/CeresConfig.cmake.in @@ -310,4 +310,10 @@ if (NOT TARGET ceres) # 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()