forked from jaegertracing/jaeger-client-cpp
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support building with local dependencies (no Hunter)
Add support for finding jaeger-cpp's dependencies via the normal local CMake package discovery mechanism of Find modules. Improves jaegertracing#38 Offline builds This introduces support for building with cmake -DHUNTER_ENABLED=0 Limitations: - Requires a locally installed Thrift 0.9.2 or 0.9.3 EXACTLY, not newer or older. These versions are not widely packaged so a local install is necessary. (jaegertracing#45) - Requires nlohmann json 2.1.0 or newer, which is not widely packaged in Linux distros. Install a local copy. (jaegertracing#47) Signed-off-by: Craig Ringer <craig@2ndquadrant.com>
- Loading branch information
Showing
8 changed files
with
158 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Find jsoncpp | ||
# | ||
# Find the nlohmann json header | ||
# | ||
# if you nee to add a custom library search path, do it via via CMAKE_PREFIX_PATH | ||
# | ||
# This module defines | ||
# | ||
# nlohmann_json_INCLUDE_DIR, where to find header, etc. | ||
# | ||
# nlohmann_json_FOUND, If false, do not try to use jsoncpp. | ||
# | ||
# nlohmann_json_LIBRARIES, empty since no linkage is required, this | ||
# is a header-only library. | ||
# | ||
# nlohmann_json_INCLUDE_NAME, the actual header name. You only have | ||
# to use this if you want to support 2.0.x which installs | ||
# a top-level json.hpp instead of nlohmann/json.hpp | ||
# | ||
|
||
# only look in default directories | ||
set(nlohmann_json_INCLUDE_NAME "nlohmann/json.hpp") | ||
find_path( | ||
nlohmann_json_INCLUDE_DIR | ||
NAMES "${nlohmann_json_INCLUDE_NAME}" | ||
DOC "nlohmann json include dir" | ||
) | ||
|
||
if (NOT nlohmann_json_INCLUDE_DIR) | ||
set(nlohmann_json_INCLUDE_NAME "json.hpp") | ||
find_path( | ||
nlohmann_json_INCLUDE_DIR | ||
NAMES "${nlohmann_json_INCLUDE_NAME}" | ||
) | ||
endif() | ||
|
||
set(nlohmann_json_INCLUDE_NAME ${nlohmann_json_INCLUDE_NAME} CACHE STRING "nlohmann header file name") | ||
|
||
set(nlohmann_json_LIBRARIES NOTFOUND CACHE STRING "no library is required by nlohmann_json") | ||
|
||
# Version detection. Unfortunately the header doesn't expose a proper version | ||
# define. | ||
if (nlohmann_json_INCLUDE_DIR AND nlohmann_json_INCLUDE_NAME) | ||
file(READ "${nlohmann_json_INCLUDE_DIR}/${nlohmann_json_INCLUDE_NAME}" NL_HDR_TXT LIMIT 1000) | ||
if (NL_HDR_TXT MATCHES "version ([0-9]+\.[0-9]+\.[0-9]+)") | ||
set(nlohmann_json_VERSION "${CMAKE_MATCH_1}") | ||
endif() | ||
endif() | ||
|
||
set(nlohmann_json_VERSION "${nlohmann_json_VERSION}" CACHE STRING "nlohmann header version") | ||
|
||
# handle the QUIETLY and REQUIRED arguments and set nlohmann_json_FOUND to TRUE | ||
# if all listed variables are TRUE, hide their existence from configuration view | ||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args( | ||
nlohmann_json | ||
REQUIRED_VARS nlohmann_json_INCLUDE_DIR nlohmann_json_INCLUDE_NAME | ||
VERSION_VAR nlohmann_json_VERSION) |
Oops, something went wrong.