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 a CMake TSL_ROBIN_MAP_ENABLE_INSTALL option to explicity enable/disable the install target #67

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
19 changes: 10 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ project(tsl-robin-map VERSION 1.2.1 LANGUAGES CXX)
include(GNUInstallDirs)


set(IS_MAIN_PROJECT FALSE)
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(IS_MAIN_PROJECT TRUE)
endif()

# Enable the install target if the project is used main project (disable by default if subproject)
option(TSL_ROBIN_MAP_ENABLE_INSTALL "Enable install target" ${IS_MAIN_PROJECT})


add_library(robin_map INTERFACE)
# Use tsl::robin_map as target, more consistent with other libraries conventions (Boost, Qt, ...)
add_library(tsl::robin_map ALIAS robin_map)
Expand All @@ -25,16 +34,8 @@ if(MSVC)
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_DATAROOTDIR}/tsl-robin-map.natvis>")
endif()




set(IS_SUBPROJECT TRUE)
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(IS_SUBPROJECT FALSE)
endif()

# Installation
if(NOT IS_SUBPROJECT)
if(TSL_ROBIN_MAP_ENABLE_INSTALL)
include(CMakePackageConfigHelpers)

## Install include directory and potential natvis file
Expand Down