Silence LocalParameterization deprecation warnings
Suppress warnings in all Ceres targets without leaking suppressions into
user code (fixes #750).
Change-Id: I3aa1063cb0aae547865a15311ac286ef6d81a955
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 65a6f94..f24f173 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -649,6 +649,12 @@
endif(HAVE_RETURN_TYPE_C_LINKAGE)
endif ()
+# Disable warnings about deprecated interfaces while we are
+# transitioning from LocalParameterization to Manifolds.
+add_compile_options(
+ $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:-Wno-deprecated-declarations>
+ $<$<CXX_COMPILER_ID:MSVC>:/wd4996>)
+
# Configure the Ceres config.h compile options header using the current
# compile options and put the configured header into the Ceres build
# directory. Note that the ceres/internal subdir in <build>/config where
diff --git a/internal/ceres/CMakeLists.txt b/internal/ceres/CMakeLists.txt
index d009ac2..5ac71a9 100644
--- a/internal/ceres/CMakeLists.txt
+++ b/internal/ceres/CMakeLists.txt
@@ -262,13 +262,6 @@
VERSION ${CERES_VERSION}
SOVERSION ${CERES_VERSION_MAJOR})
-# Disable warnings about deprecated interfaces while we are
-# transitioning from LocalParameterization to Manifolds.
-target_compile_options(ceres PRIVATE
- $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
- -Wno-deprecated-declarations>
- $<$<CXX_COMPILER_ID:MSVC>: /wd4996>)
-
if (BUILD_SHARED_LIBS)
set_target_properties(ceres PROPERTIES
# Set the default symbol visibility to hidden to unify the behavior among
@@ -443,13 +436,6 @@
${CERES_LIBRARY_PRIVATE_DEPENDENCIES_INCLUDE_DIRS})
- # Disable warnings about deprecated interfaces while we are
- # transitioning from LocalParameterization to Manifolds.
- target_compile_options(${NAME}_test PRIVATE
- $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
- -Wno-deprecated-declarations>
- $<$<CXX_COMPILER_ID:MSVC>: /wd4996>)
-
target_link_libraries(${NAME}_test PUBLIC test_util Ceres::ceres gtest)
if (BUILD_SHARED_LIBS)
# Define gtest-specific shared library flags for linking.