1
0
mirror of https://github.com/wqking/eventpp.git synced 2024-12-27 00:17:02 +08:00

Merge pull request #40 from rotolof/install_option

Enable or disable installation
This commit is contained in:
Wang Qi 2022-05-28 16:32:17 +08:00 committed by GitHub
commit a135c761b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,10 +12,24 @@ target_include_directories(
add_library(eventpp::eventpp ALIAS eventpp) add_library(eventpp::eventpp ALIAS eventpp)
# Checks if eventpp is the main project or if it is
# being built as a subproject (using add_subdirectory/FetchContent).
set(MAIN_PROJECT OFF)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(MAIN_PROJECT ON)
endif()
# Installation # Installation
# ------------ # ------------
include(GNUInstallDirs) include(GNUInstallDirs)
if (POLICY CMP0077)
# Allow CMake 3.13+ to override options when using add_subdirectory/FetchContent.
cmake_policy(SET CMP0077 NEW)
endif (POLICY CMP0077)
option(EVENTPP_INSTALL "Enable installation" ${MAIN_PROJECT})
if (EVENTPP_INSTALL)
# Install the library # Install the library
install( install(
TARGETS eventpp TARGETS eventpp
@ -68,3 +82,4 @@ install(
license license
DESTINATION ${CMAKE_INSTALL_DATADIR}/eventpp DESTINATION ${CMAKE_INSTALL_DATADIR}/eventpp
) )
endif()