Skip to content

Commit 63cd6d1

Browse files
committed
Update CMakeLists.txt to install the cmake bindings in the right location
/usr/lib/cpprestsdk is not the correct FHS standard cmake location. It should be placed in /usr/lib/<triplet>/cmake/cpprestsdk instead. Same goes for libraries, support multiarch location if we use UNIX
1 parent b024470 commit 63cd6d1

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

Release/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ enable_testing()
1818
set(WERROR ON CACHE BOOL "Treat Warnings as Errors.")
1919
set(CPPREST_EXCLUDE_WEBSOCKETS OFF CACHE BOOL "Exclude websockets functionality.")
2020
set(CPPREST_EXCLUDE_COMPRESSION OFF CACHE BOOL "Exclude compression functionality.")
21-
set(CPPREST_EXPORT_DIR lib/cpprestsdk CACHE STRING "Directory to install CMake config files.")
2221
set(CPPREST_INSTALL_HEADERS ON CACHE BOOL "Install header files.")
2322
set(CPPREST_INSTALL ON CACHE BOOL "Add install commands.")
2423

@@ -63,6 +62,9 @@ include(cmake/cpprest_find_zlib.cmake)
6362
include(cmake/cpprest_find_openssl.cmake)
6463
include(cmake/cpprest_find_websocketpp.cmake)
6564
include(CheckIncludeFiles)
65+
if(UNIX)
66+
include(GNUInstallDirs)
67+
endif(UNIX)
6668

6769
find_package(Threads REQUIRED)
6870
if(THREADS_HAVE_PTHREAD_ARG)

Release/src/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,21 +250,21 @@ if(CPPREST_INSTALL)
250250
install(
251251
TARGETS ${CPPREST_TARGETS}
252252
EXPORT cpprestsdk-targets
253-
RUNTIME DESTINATION bin
254-
LIBRARY DESTINATION lib
255-
ARCHIVE DESTINATION lib
253+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
254+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
255+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
256256
)
257257

258258
configure_file(../cmake/cpprestsdk-config.in.cmake "${CMAKE_CURRENT_BINARY_DIR}/cpprestsdk-config.cmake" @ONLY)
259259

260260
install(
261261
FILES "${CMAKE_CURRENT_BINARY_DIR}/cpprestsdk-config.cmake"
262-
DESTINATION ${CPPREST_EXPORT_DIR}
262+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake
263263
)
264264
install(
265265
EXPORT cpprestsdk-targets
266266
FILE cpprestsdk-targets.cmake
267267
NAMESPACE cpprestsdk::
268-
DESTINATION ${CPPREST_EXPORT_DIR}
268+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake
269269
)
270270
endif()

0 commit comments

Comments
 (0)