Skip to content

Commit

Permalink
CMake: Fix duplicate uninstall target (#406)
Browse files Browse the repository at this point in the history
* fix whitespace in CMakeLists
* fix uninstall targets
  • Loading branch information
csculley authored Dec 9, 2023
1 parent 8178b4f commit 3649ccb
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 35 deletions.
8 changes: 3 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ ADD_SUBDIRECTORY( octomap )

if(BUILD_OCTOVIS_SUBPROJECT)
ADD_SUBDIRECTORY( octovis )
endif()
endif()

if(BUILD_DYNAMICETD3D_SUBPROJECT)
if(BUILD_DYNAMICETD3D_SUBPROJECT)
ADD_SUBDIRECTORY( dynamicEDT3D )
endif()


endif()
23 changes: 12 additions & 11 deletions dynamicEDT3D/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,20 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/share/ament_index/resource_index/packa
#TODO: this conflicts with the octomap uninstall
#it is not only a target name problem, also both will use the same manifest file
#in the same binary directory
#configure_file(
# "${PROJECT_SOURCE_DIR}/CMakeModules/CMakeUninstall.cmake.in"
# "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
# IMMEDIATE @ONLY)
#
#add_custom_target(uninstall
# COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
if(NOT TARGET uninstall)
configure_file(
"${PROJECT_SOURCE_DIR}/CMakeModules/CMakeUninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)

add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()

# Export the package for use from the build-tree
# (this registers the build-tree with a global CMake-registry)
export(PACKAGE dynamicEDT3D)

# Create a dynamicEDT3DConfig.cmake file for the use from the build tree
set(DYNAMICEDT3D_INCLUDE_DIRS "${INCLUDE_DIRS}")
set(DYNAMICEDT3D_LIB_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
Expand Down Expand Up @@ -122,7 +123,7 @@ WRITE_BASIC_PACKAGE_VERSION_FILE(
#install(EXPORT FooBarLibraryDepends DESTINATION
# "${INSTALL_DATA_DIR}/FooBar/CMake"
# COMPONENT dev)

# Create a dynamicEDT3DConfig.cmake file for the use from the install tree
# and install it
set(DYNAMICEDT3D_INCLUDE_DIRS "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
Expand All @@ -145,7 +146,7 @@ WRITE_BASIC_PACKAGE_VERSION_FILE(

install(FILES
"${PROJECT_BINARY_DIR}/InstallFiles/dynamicEDT3DConfig.cmake"
"${PROJECT_BINARY_DIR}/InstallFiles/dynamicEDT3DConfig-version.cmake"
"${PROJECT_BINARY_DIR}/InstallFiles/dynamicEDT3DConfig-version.cmake"
DESTINATION "${CMAKE_INSTALL_DATADIR}/dynamicEDT3D")

# Write pkgconfig-file:
Expand All @@ -157,7 +158,7 @@ install_pkg_config_file(dynamicEDT3D
VERSION ${DYNAMICEDT3D_VERSION})


# Documentation
# Documentation
FIND_PACKAGE(Doxygen)
IF(DOXYGEN_FOUND)
ADD_CUSTOM_TARGET(docs_dynamicEDT3D ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/dynamicEDT3D.dox
Expand Down
20 changes: 11 additions & 9 deletions octomap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,20 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/share/ament_index/resource_index/packages
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/share/ament_index/resource_index/packages/${PROJECT_NAME} DESTINATION share/ament_index/resource_index/packages)

# uninstall target
configure_file(
"${PROJECT_SOURCE_DIR}/CMakeModules/CMakeUninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
if(NOT TARGET uninstall)
configure_file(
"${PROJECT_SOURCE_DIR}/CMakeModules/CMakeUninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)

add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()

# Export the package for use from the build-tree
# (this registers the build-tree with a global CMake-registry)
export(PACKAGE octomap)

# Create a octomap-config.cmake file for the use from the build tree
set(OCTOMAP_INCLUDE_DIRS "${INCLUDE_DIRS}")
set(OCTOMAP_LIB_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
Expand Down Expand Up @@ -147,7 +149,7 @@ WRITE_BASIC_PACKAGE_VERSION_FILE(

install(FILES
"${PROJECT_BINARY_DIR}/InstallFiles/octomap-config.cmake"
"${PROJECT_BINARY_DIR}/InstallFiles/octomap-config-version.cmake"
"${PROJECT_BINARY_DIR}/InstallFiles/octomap-config-version.cmake"
DESTINATION "${CMAKE_INSTALL_DATADIR}/octomap")

# Write pkgconfig-file:
Expand All @@ -158,7 +160,7 @@ install_pkg_config_file(octomap
REQUIRES
VERSION ${OCTOMAP_VERSION})

# Documentation
# Documentation
FIND_PACKAGE(Doxygen)
IF(DOXYGEN_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/octomap.dox.in ${CMAKE_CURRENT_BINARY_DIR}/octomap.dox @ONLY)
Expand Down
19 changes: 9 additions & 10 deletions octovis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ set(INSTALL_TARGETS_DEFAULT_ARGS
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)

# Builds the "octovis" viewer based on OpenGL and
# Builds the "octovis" viewer based on OpenGL and
# libQGLViewer, if dependencies available
SET( BUILD_VIEWER 0)

Expand All @@ -73,8 +73,8 @@ if(NOT OCTOVIS_QT5)
FIND_PACKAGE(Qt4)
endif(NOT OCTOVIS_QT5)

IF (OpenGL-NOTFOUND OR Qt4-NOTFOUND)
MESSAGE ( "OpenGL and QT4 are required for octovis but could not be found.")
IF (OpenGL-NOTFOUND OR Qt4-NOTFOUND)
MESSAGE ( "OpenGL and QT4 are required for octovis but could not be found.")
ELSE()
FIND_PACKAGE(QGLViewer)
IF(QGLViewer_FOUND)
Expand All @@ -89,12 +89,12 @@ ENDIF()
IF(BUILD_VIEWER)
MESSAGE(STATUS "\n")
MESSAGE(STATUS "viewer octovis will be built")

set(INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include")
INCLUDE_DIRECTORIES(${INCLUDE_DIRS})

INCLUDE( CMakeLists_src.txt )

# Create an octovis-config.cmake file for the use from the build tree
set(OCTOVIS_INCLUDE_DIRS "${INCLUDE_DIRS}")
set(OCTOVIS_LIB_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
Expand Down Expand Up @@ -125,7 +125,7 @@ IF(BUILD_VIEWER)

# not used right now (export depends?)
#set(OCTOMAP_CMAKE_DIR "${PROJECT_BINARY_DIR}")

# Create a octovis-config.cmake file for the use from the install tree
# and install it
set(OCTOVIS_INCLUDE_DIRS "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
Expand All @@ -148,7 +148,7 @@ IF(BUILD_VIEWER)

install(FILES
"${PROJECT_BINARY_DIR}/InstallFiles/octovis-config.cmake"
"${PROJECT_BINARY_DIR}/InstallFiles/octovis-config-version.cmake"
"${PROJECT_BINARY_DIR}/InstallFiles/octovis-config-version.cmake"
DESTINATION "${CMAKE_INSTALL_DATADIR}/octovis")

# #installation:
Expand All @@ -162,10 +162,9 @@ IF(BUILD_VIEWER)
# Allows Colcon to find non-Ament packages when using workspace underlays
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/share/ament_index/resource_index/packages/${PROJECT_NAME} "")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/share/ament_index/resource_index/packages/${PROJECT_NAME} DESTINATION share/ament_index/resource_index/packages)

ELSE()
MESSAGE ( "Unfortunately, the viewer (octovis) can not be built because some requirements are missing.")
MESSAGE ( "This will not affect the compilation of the stand-alone library and tools (octomap)")
MESSAGE ( "See README.txt or http://octomap.sf.net for further information.\n")
ENDIF()

0 comments on commit 3649ccb

Please sign in to comment.