From bbfe93c248ce198246328d52bda5b4e6dd4cc95e Mon Sep 17 00:00:00 2001 From: Arthur Kasimov Date: Thu, 21 Sep 2023 06:02:17 +0600 Subject: [PATCH] Add CMake option to disable installation of headers and libraries --- CMakeLists.txt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fb8b4dc7..da4624dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 2.8.12...3.20) project(enet) +option(ENET_NO_INSTALL "Disable installation of headers and libraries" OFF) + # The "configure" step. include(CheckFunctionExists) include(CheckStructHasMember) @@ -108,10 +110,12 @@ if (MINGW) target_link_libraries(enet winmm ws2_32) endif() -install(TARGETS enet - RUNTIME DESTINATION bin - ARCHIVE DESTINATION lib/static - LIBRARY DESTINATION lib) +if(NOT ENET_NO_INSTALL) + install(TARGETS enet + RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib/static + LIBRARY DESTINATION lib) -install(DIRECTORY include/ - DESTINATION include) + install(DIRECTORY include/ + DESTINATION include) +endif()