Skip to content

Commit

Permalink
Make the custom uninstall target optional
Browse files Browse the repository at this point in the history
Ceres-solver provides a custom uninstall target to ease the removal of
installed files from the system. This clashes with other projects, that
too provide an uninstall target (like Eigen3).

Related issue: ceres-solver#451 (comment)

Change-Id: Id153830ae20a880d23c7468acb39f55f48a2129a
  • Loading branch information
NeroBurner committed Dec 16, 2019
1 parent edb8322 commit 8bcf51f
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ option(BUILD_DOCUMENTATION "Build User's Guide (html)" OFF)
option(BUILD_EXAMPLES "Build examples" ON)
option(BUILD_BENCHMARKS "Build Ceres benchmarking suite" ON)
option(BUILD_SHARED_LIBS "Build Ceres as a shared library." OFF)
option(PROVIDE_UNINSTALL_TARGET "Add a custom target to ease removal of installed targets" ON)
option(CODE_GENERATION "Build the code generation module." OFF)
if(CODE_GENERATION)
message(WARNING "The code generation module is still under development. The functionality and API of the current implementation might change in the future.")
Expand Down Expand Up @@ -762,12 +763,14 @@ install(FILES "${Ceres_BINARY_DIR}/CeresConfigVersion.cmake"
"${Ceres_SOURCE_DIR}/cmake/FindGlog.cmake"
DESTINATION ${RELATIVE_CMAKECONFIG_INSTALL_DIR})

# Create an uninstall target to remove all installed files.
configure_file("${Ceres_SOURCE_DIR}/cmake/uninstall.cmake.in"
"${Ceres_BINARY_DIR}/cmake/uninstall.cmake"
@ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${Ceres_BINARY_DIR}/cmake/uninstall.cmake)
if (PROVIDE_UNINSTALL_TARGET)
# Create an uninstall target to remove all installed files.
configure_file("${Ceres_SOURCE_DIR}/cmake/uninstall.cmake.in"
"${Ceres_BINARY_DIR}/cmake/uninstall.cmake"
@ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${Ceres_BINARY_DIR}/cmake/uninstall.cmake)
endif()

# Install method #2: Put Ceres build into local CMake registry.
#
Expand Down

0 comments on commit 8bcf51f

Please sign in to comment.