mirror of
https://github.com/wqking/eventpp.git
synced 2024-12-26 15:52:40 +08:00
Merge pull request #40 from rotolof/install_option
Enable or disable installation
This commit is contained in:
commit
a135c761b4
@ -12,10 +12,24 @@ target_include_directories(
|
||||
|
||||
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
|
||||
# ------------
|
||||
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(
|
||||
TARGETS eventpp
|
||||
@ -68,3 +82,4 @@ install(
|
||||
license
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/eventpp
|
||||
)
|
||||
endif()
|
Loading…
x
Reference in New Issue
Block a user