Skip to content

Commit

Permalink
Update CMakeLists.txt to install the cmake bindings in the right loca…
Browse files Browse the repository at this point in the history
…tion

/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
  • Loading branch information
LocutusOfBorg committed Apr 23, 2018
1 parent b024470 commit 63cd6d1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion Release/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ enable_testing()
set(WERROR ON CACHE BOOL "Treat Warnings as Errors.")
set(CPPREST_EXCLUDE_WEBSOCKETS OFF CACHE BOOL "Exclude websockets functionality.")
set(CPPREST_EXCLUDE_COMPRESSION OFF CACHE BOOL "Exclude compression functionality.")
set(CPPREST_EXPORT_DIR lib/cpprestsdk CACHE STRING "Directory to install CMake config files.")
set(CPPREST_INSTALL_HEADERS ON CACHE BOOL "Install header files.")
set(CPPREST_INSTALL ON CACHE BOOL "Add install commands.")

Expand Down Expand Up @@ -63,6 +62,9 @@ include(cmake/cpprest_find_zlib.cmake)
include(cmake/cpprest_find_openssl.cmake)
include(cmake/cpprest_find_websocketpp.cmake)
include(CheckIncludeFiles)
if(UNIX)
include(GNUInstallDirs)
endif(UNIX)

find_package(Threads REQUIRED)
if(THREADS_HAVE_PTHREAD_ARG)
Expand Down
10 changes: 5 additions & 5 deletions Release/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -250,21 +250,21 @@ if(CPPREST_INSTALL)
install(
TARGETS ${CPPREST_TARGETS}
EXPORT cpprestsdk-targets
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

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

install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/cpprestsdk-config.cmake"
DESTINATION ${CPPREST_EXPORT_DIR}
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake
)
install(
EXPORT cpprestsdk-targets
FILE cpprestsdk-targets.cmake
NAMESPACE cpprestsdk::
DESTINATION ${CPPREST_EXPORT_DIR}
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake
)
endif()

0 comments on commit 63cd6d1

Please sign in to comment.