11cmake_minimum_required (VERSION 3.8)
22
3- if (DEFINED PROJECT_NAME )
4- set (INDICATORS_SUBPROJECT ON )
3+ if (NOT DEFINED PROJECT_NAME )
4+ set (INDICATORS_IS_TOP_LEVEL ON )
5+ else ()
6+ set (INDICATORS_IS_TOP_LEVEL OFF )
57endif ()
68
79if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.12" )
@@ -20,6 +22,8 @@ if(EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
2022 conan_basic_setup()
2123endif ()
2224
25+ option (INDICATORS_INSTALL "Include an install target" ${INDICATORS_IS_TOP_LEVEL} )
26+ option (INDICATORS_PACKAGE "Include package targets" ${INDICATORS_IS_TOP_LEVEL} )
2327option (INDICATORS_BUILD_TESTS "Build indicators tests + enable CTest" )
2428option (INDICATORS_SAMPLES "Build indicators samples" )
2529option (INDICATORS_DEMO "Build indicators demo" OFF )
@@ -46,7 +50,7 @@ if(INDICATORS_SAMPLES)
4650 add_subdirectory (samples)
4751endif ()
4852
49- if (NOT INDICATORS_SUBPROJECT )
53+ if (INDICATORS_INSTALL )
5054 configure_package_config_file(indicatorsConfig.cmake.in
5155 ${CMAKE_CURRENT_BINARY_DIR} /indicatorsConfig.cmake
5256 INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR} /cmake/indicators)
@@ -71,7 +75,9 @@ if(NOT INDICATORS_SUBPROJECT)
7175 PATTERN "*.hpp" )
7276 install (FILES LICENSE LICENSE.termcolor
7377 DESTINATION ${CMAKE_INSTALL_DATAROOTDIR} /licenses/indicators)
78+ endif ()
7479
80+ if (INDICATORS_PACKAGE)
7581 if (EXISTS "${PROJECT_SOURCE_DIR} /.gitignore" )
7682 # Simple glob to regex conversion (.gitignore => CPACK_SOURCE_IGNORE_FILES)
7783 file (READ ".gitignore" DOT_GITIGNORE)
0 commit comments