Merge pull request #911 from theodelrieu/fix/cmake_install

Fix/cmake install
This commit is contained in:
Niels Lohmann 2018-01-14 20:08:49 +01:00 committed by GitHub
commit d9446b0e6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 9 additions and 4 deletions

1
.gitignore vendored
View file

@ -21,4 +21,3 @@ benchmarks/files/numbers/*.json
cmake-build-debug
test/test-*
third_party/Amalgamate

View file

@ -16,12 +16,12 @@ include(ExternalProject)
## OPTIONS
##
option(JSON_BuildTests "Build the unit tests when BUILD_TESTING is enabled." ON)
option(JSON_MultipleHeaders "Use non-amalgamated version of the library." OFF)
##
## CONFIGURATION
##
set(NLOHMANN_JSON_TARGET_NAME ${PROJECT_NAME})
set(NLOHMANN_JSON_SOURCE_DIR "src")
set(NLOHMANN_JSON_CONFIG_INSTALL_DIR "lib/cmake/${PROJECT_NAME}")
set(NLOHMANN_JSON_INCLUDE_INSTALL_DIR "include")
set(NLOHMANN_JSON_HEADER_INSTALL_DIR "${NLOHMANN_JSON_INCLUDE_INSTALL_DIR}/nlohmann")
@ -31,6 +31,12 @@ set(NLOHMANN_JSON_CMAKE_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}/cmake_c
set(NLOHMANN_JSON_CMAKE_VERSION_CONFIG_FILE "${NLOHMANN_JSON_CMAKE_CONFIG_DIR}/${PROJECT_NAME}ConfigVersion.cmake")
set(NLOHMANN_JSON_CMAKE_PROJECT_CONFIG_FILE "${NLOHMANN_JSON_CMAKE_CONFIG_DIR}/${PROJECT_NAME}Config.cmake")
if (JSON_MultipleHeaders)
set(NLOHMANN_JSON_SOURCE_DIR "develop/")
else()
set(NLOHMANN_JSON_SOURCE_DIR "src/")
endif()
##
## TARGET
## create target and add include path
@ -40,7 +46,7 @@ add_library(${NLOHMANN_JSON_TARGET_NAME} INTERFACE)
target_include_directories(
${NLOHMANN_JSON_TARGET_NAME}
INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/${NLOHMANN_JSON_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
)

View file

@ -254,7 +254,7 @@ pretty:
amalgamate: src/json.hpp
src/json.hpp: $(SRCS)
develop/amalgamate/amalgamate.py -c develop/amalgamate/config.json -s develop --verbose=yes
third_party/amalgamate/amalgamate.py -c third_party/amalgamate/config.json -s develop --verbose=yes
$(MAKE) pretty
# check if src/json.hpp has been amalgamated from the develop sources

View file