Skip to content

Commit b7e1c80

Browse files
committed
Use GNUInstallDirs
1 parent 9146fdb commit b7e1c80

File tree

4 files changed

+37
-15
lines changed

4 files changed

+37
-15
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ if(WIN32)
246246
set(PCL_POINTCLOUDS_DIR "${PCL_RESOURCES_DIR}/pointclouds")
247247
endif()
248248

249+
#Set up output directory for builds
249250
set(PCL_OUTPUT_LIB_DIR "${PCL_BINARY_DIR}/${LIB_INSTALL_DIR}")
250251
set(PCL_OUTPUT_BIN_DIR "${PCL_BINARY_DIR}/${BIN_INSTALL_DIR}")
251252
make_directory("${PCL_OUTPUT_LIB_DIR}")
@@ -274,6 +275,7 @@ if(CMAKE_GENERATOR_IS_IDE)
274275
else()
275276
set(UNINSTALL_TARGET_NAME uninstall)
276277
endif()
278+
277279
configure_file("${PCL_SOURCE_DIR}/cmake/uninstall_target.cmake.in"
278280
"${PCL_BINARY_DIR}/uninstall_target.cmake" IMMEDIATE @ONLY)
279281
add_custom_target(${UNINSTALL_TARGET_NAME} "${CMAKE_COMMAND}" -P

cmake/pcl_pclconfig.cmake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,6 @@ if(Boost_SERIALIZATION_FOUND)
9393
string(APPEND PCLCONFIG_AVAILABLE_BOOST_MODULES " serialization")
9494
endif()
9595

96-
include(GNUInstallDirs)
97-
set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}/pcl
98-
CACHE PATH "Location of header files" )
99-
10096
include(CMakePackageConfigHelpers)
10197

10298
configure_package_config_file(PCLConfig.cmake.in

cmake/pcl_targets.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ function(PCL_ADD_LIBRARY _name)
243243
EXPORT ${_name}Targets
244244
NAMESPACE pcl::
245245
FILE ${_name}.cmake
246-
DESTINATION ${LIB_INSTALL_DIR}/cmake
246+
DESTINATION ${PCLCONFIG_INSTALL_DIR}
247247
)
248248

249249
# Copy PDB if available

cmake/pcl_utils.cmake

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,20 +91,44 @@ endmacro()
9191
# subdirectory named after the library in question (e.g.
9292
# "registration/blorgle.h")
9393
macro(SET_INSTALL_DIRS)
94+
include(GNUInstallDirs)
95+
9496
if(NOT DEFINED LIB_INSTALL_DIR)
95-
set(LIB_INSTALL_DIR "lib")
97+
set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR})
98+
endif()
99+
100+
if(NOT ANDROID)
101+
set(INCLUDE_INSTALL_ROOT
102+
"${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME_LOWER}-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}")
103+
else()
104+
set(INCLUDE_INSTALL_ROOT ${CMAKE_INSTALL_INCLUDEDIR}) # Android, don't put into subdir
105+
endif()
106+
107+
if(NOT DEFINED INCLUDE_INSTALL_DIR)
108+
set(INCLUDE_INSTALL_DIR "${INCLUDE_INSTALL_ROOT}/pcl")
109+
endif()
110+
111+
if(NOT DEFINED DOC_INSTALL_DIR)
112+
set(DOC_INSTALL_DIR "${CMAKE_INSTALL_DOCDIR}")
96113
endif()
97-
if(NOT ANDROID)
98-
set(INCLUDE_INSTALL_ROOT
99-
"include/${PROJECT_NAME_LOWER}-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}")
114+
115+
if(NOT DEFINED BIN_INSTALL_DIR)
116+
set(BIN_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}")
117+
endif()
118+
119+
if(NOT DEFINED PKGCFG_INSTALL_DIR)
120+
set(PKGCFG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
121+
endif()
122+
123+
if(NOT DEFINED PCLCONFIG_INSTALL_DIR)
124+
if(WIN32 AND NOT MINGW)
125+
set(PCLCONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake")
100126
else()
101-
set(INCLUDE_INSTALL_ROOT "include") # Android, don't put into subdir
127+
# Most distributions install cmake config files in /usr/lib*/cmake
128+
# and not in /usr/share/cmake.
129+
set(PCLCONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME_LOWER}-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}")
102130
endif()
103-
set(INCLUDE_INSTALL_DIR "${INCLUDE_INSTALL_ROOT}/pcl")
104-
set(DOC_INSTALL_DIR "share/doc/${PROJECT_NAME_LOWER}-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}")
105-
set(BIN_INSTALL_DIR "bin")
106-
set(PKGCFG_INSTALL_DIR "${LIB_INSTALL_DIR}/pkgconfig")
107-
set(PCLCONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/cmake")
131+
endif()
108132
endmacro()
109133

110134

0 commit comments

Comments
 (0)