Skip to content

Commit

Permalink
[build] use the default TARGETS installation folder when possible
Browse files Browse the repository at this point in the history
It is implied by each target type (static and dynamic libraries here):

> For regular executables, static libraries and shared libraries, the
> DESTINATION argument is not required. For these target types, when
> DESTINATION is omitted, a default destination will be taken from the
> appropriate variable from GNUInstallDirs, or set to a built-in default value
> if that variable is not defined.

https://cmake.org/cmake/help/v3.14/command/install.html#targets
  • Loading branch information
robUx4 authored and maxsharabayko committed Sep 9, 2022
1 parent 286b43e commit 3709471
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1074,12 +1074,24 @@ if (CYGWIN)
endif()

message(STATUS "INSTALL DIRS: bin=${CMAKE_INSTALL_BINDIR} lib=${CMAKE_INSTALL_LIBDIR} shlib=${INSTALL_SHARED_DIR} include=${CMAKE_INSTALL_INCLUDEDIR}")

install(TARGETS ${INSTALL_TARGETS}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
if (NEED_DESTINATION)
if (DEFINED CMAKE_INSTALL_BINDIR AND DEFINED CMAKE_INSTALL_LIBDIR AND NOT INSTALL_SHARED_DIR STREQUAL "")
install(TARGETS ${INSTALL_TARGETS}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${INSTALL_SHARED_DIR}
)
else()
message(WARNING "No location to install ${INSTALL_TARGETS}")
endif()
elseif (NOT INSTALL_SHARED_DIR STREQUAL "")
install(TARGETS ${INSTALL_TARGETS}
LIBRARY DESTINATION ${INSTALL_SHARED_DIR}
)
)
else()
install(TARGETS ${INSTALL_TARGETS})
endif()

install(FILES ${HEADERS_srt} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/srt)
if (WIN32)
install(FILES ${HEADERS_srt_win32} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/srt/win)
Expand Down

0 comments on commit 3709471

Please sign in to comment.