Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CMake options INDICATORS_INSTALL and INDICATORS_PACKAGE #141

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
cmake_minimum_required(VERSION 3.8)

if(DEFINED PROJECT_NAME)
set(INDICATORS_SUBPROJECT ON)
if(NOT DEFINED PROJECT_NAME)
set(INDICATORS_IS_TOP_LEVEL ON)
else()
set(INDICATORS_IS_TOP_LEVEL OFF)
endif()

if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.12")
Expand All @@ -20,6 +22,8 @@ if(EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
conan_basic_setup()
endif()

option(INDICATORS_INSTALL "Include an install target" ${INDICATORS_IS_TOP_LEVEL})
option(INDICATORS_PACKAGE "Include package targets" ${INDICATORS_IS_TOP_LEVEL})
option(INDICATORS_BUILD_TESTS "Build indicators tests + enable CTest")
option(INDICATORS_SAMPLES "Build indicators samples")
option(INDICATORS_DEMO "Build indicators demo" OFF)
Expand All @@ -46,7 +50,7 @@ if(INDICATORS_SAMPLES)
add_subdirectory(samples)
endif()

if(NOT INDICATORS_SUBPROJECT)
if(INDICATORS_INSTALL)
configure_package_config_file(indicatorsConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/indicatorsConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/indicators)
Expand All @@ -71,7 +75,9 @@ if(NOT INDICATORS_SUBPROJECT)
PATTERN "*.hpp")
install(FILES LICENSE LICENSE.termcolor
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/licenses/indicators)
endif()

if(INDICATORS_PACKAGE)
if(EXISTS "${PROJECT_SOURCE_DIR}/.gitignore")
# Simple glob to regex conversion (.gitignore => CPACK_SOURCE_IGNORE_FILES)
file(READ ".gitignore" DOT_GITIGNORE)
Expand Down