1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-10-24 14:53:03 +03:00

cmake: add LIBSSH2_DISABLE_INSTALL option

To disable all installation targets.

Closes #1638
This commit is contained in:
trustytrojan
2025-08-07 08:35:20 -04:00
committed by Viktor Szakats
parent 0ec6b3e842
commit dd50a41152
3 changed files with 229 additions and 222 deletions

View File

@@ -172,12 +172,15 @@ if(NOT LIBSSH2_VERSION OR
message(FATAL_ERROR "Unable to parse version from ${PROJECT_SOURCE_DIR}/include/libssh2.h")
endif()
option(LIBSSH2_DISABLE_INSTALL "Disable installation targets" OFF)
if(NOT LIBSSH2_DISABLE_INSTALL)
include(GNUInstallDirs)
install(
FILES
COPYING NEWS README RELEASE-NOTES
docs/AUTHORS docs/BINDINGS.md docs/HACKING.md
DESTINATION ${CMAKE_INSTALL_DOCDIR})
endif()
include(PickyWarnings)

View File

@@ -40,5 +40,7 @@ libssh2_transform_makefile_inc("Makefile.am" "${CMAKE_CURRENT_BINARY_DIR}/Makefi
# Get dist_man_MANS variable
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.am.cmake")
if(NOT LIBSSH2_DISABLE_INSTALL)
include(GNUInstallDirs)
install(FILES ${dist_man_MANS} DESTINATION "${CMAKE_INSTALL_MANDIR}/man3")
endif()

View File

@@ -177,6 +177,7 @@ add_library(${LIB_NAME} ALIAS ${LIB_SELECTED})
## Installation
if(NOT LIBSSH2_DISABLE_INSTALL)
install(FILES
"${PROJECT_SOURCE_DIR}/include/libssh2.h"
"${PROJECT_SOURCE_DIR}/include/libssh2_publickey.h"
@@ -405,3 +406,4 @@ write_basic_package_version_file(
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
endif()