cmake: add option to disable installing targets
This commit is contained in:
parent
87252bb5ce
commit
3db011212d
@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.2)
|
|||||||
|
|
||||||
option(JSON_VALIDATOR_BUILD_TESTS "Build tests" ON)
|
option(JSON_VALIDATOR_BUILD_TESTS "Build tests" ON)
|
||||||
option(JSON_VALIDATOR_BUILD_EXAMPLES "Build examples" ON)
|
option(JSON_VALIDATOR_BUILD_EXAMPLES "Build examples" ON)
|
||||||
|
option(JSON_VALIDATOR_INSTALL "Install target" ON)
|
||||||
option(JSON_VALIDATOR_HUNTER "Enable Hunter package manager support" OFF)
|
option(JSON_VALIDATOR_HUNTER "Enable Hunter package manager support" OFF)
|
||||||
|
|
||||||
if(JSON_VALIDATOR_HUNTER)
|
if(JSON_VALIDATOR_HUNTER)
|
||||||
@ -95,6 +96,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(JSON_VALIDATOR_INSTALL)
|
||||||
install(TARGETS nlohmann_json_schema_validator
|
install(TARGETS nlohmann_json_schema_validator
|
||||||
EXPORT ${PROJECT_NAME}Targets
|
EXPORT ${PROJECT_NAME}Targets
|
||||||
LIBRARY DESTINATION lib
|
LIBRARY DESTINATION lib
|
||||||
@ -103,6 +105,7 @@ install(TARGETS nlohmann_json_schema_validator
|
|||||||
|
|
||||||
install(FILES src/nlohmann/json-schema.hpp
|
install(FILES src/nlohmann/json-schema.hpp
|
||||||
DESTINATION include/nlohmann)
|
DESTINATION include/nlohmann)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (JSON_VALIDATOR_BUILD_EXAMPLES)
|
if (JSON_VALIDATOR_BUILD_EXAMPLES)
|
||||||
# simple nlohmann_json_schema_validator-executable
|
# simple nlohmann_json_schema_validator-executable
|
||||||
@ -127,6 +130,7 @@ endif()
|
|||||||
|
|
||||||
# Set Up the Project Targets and Config Files for CMake
|
# Set Up the Project Targets and Config Files for CMake
|
||||||
|
|
||||||
|
if(JSON_VALIDATOR_INSTALL)
|
||||||
# Set the install path to the cmake config files (Relative, so install works correctly under Hunter as well)
|
# Set the install path to the cmake config files (Relative, so install works correctly under Hunter as well)
|
||||||
set(INSTALL_CMAKE_DIR "lib/cmake/${PROJECT_NAME}")
|
set(INSTALL_CMAKE_DIR "lib/cmake/${PROJECT_NAME}")
|
||||||
set(INSTALL_CMAKEDIR_ROOT share/cmake)
|
set(INSTALL_CMAKEDIR_ROOT share/cmake)
|
||||||
@ -156,3 +160,4 @@ install(
|
|||||||
DESTINATION
|
DESTINATION
|
||||||
${INSTALL_CMAKE_DIR}
|
${INSTALL_CMAKE_DIR}
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
Loading…
Reference in New Issue
Block a user