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:
commit
a135c761b4
@ -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()
|
Loading…
x
Reference in New Issue
Block a user