Commit 0e07183d authored by Ben Boeckel's avatar Ben Boeckel Committed by Kitware Robot

Merge topic 'jsoncpp-findpkg'

e57d5aae JsonCpp: the VERSION_VAR is a separate signature
dae8b1b6 FindJsonCpp: fix typo in regex
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Reviewed-by: Utkarsh Ayachit's avatarUtkarsh Ayachit <utkarsh.ayachit@kitware.com>
Merge-request: !203
parents 2427db92 e57d5aae
......@@ -21,9 +21,9 @@ set(JsonCpp_LIBRARIES "${JsonCpp_LIBRARY}")
set(_JsonCpp_version_args)
if (EXISTS "${JsonCpp_INCLUDE_DIR}/json/version.h")
file(STRINGS "${JsonCpp_INCLUDE_DIR}/json/version.h" _JsonCpp_version_contents REGEX "#\\s+define\\s+JSONCPP_VERSION_[A-Z]+")
file(STRINGS "${JsonCpp_INCLUDE_DIR}/json/version.h" _JsonCpp_version_contents REGEX "JSONCPP_VERSION_[A-Z]+")
foreach (_JsonCpp_version_part MAJOR MINOR PATCH)
string(REGEX REPLACE ".*#\\s*define ARMA_VERSION_${_JsonCpp_version_part}\\s+([0-9]+).*" "\\1" JsonCpp_VERSION_${_JsonCpp_version_part} "${_JsonCpp_version_contents}")
string(REGEX REPLACE ".*# *define +JSONCPP_VERSION_${_JsonCpp_version_part} +([0-9]+).*" "\\1" JsonCpp_VERSION_${_JsonCpp_version_part} "${_JsonCpp_version_contents}")
endforeach ()
set(JsonCpp_VERSION_STRING "${JsonCpp_VERSION_MAJOR}.${JsonCpp_VERSION_MINOR}.${JsonCpp_VERSION_PATCH}")
......@@ -32,8 +32,8 @@ if (EXISTS "${JsonCpp_INCLUDE_DIR}/json/version.h")
endif ()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(JsonCpp DEFAULT_MSG
JsonCpp_LIBRARIES JsonCpp_INCLUDE_DIRS
find_package_handle_standard_args(JsonCpp
REQUIRED_VARS JsonCpp_LIBRARIES JsonCpp_INCLUDE_DIRS
${_JsonCpp_version_args})
mark_as_advanced(JsonCpp_INCLUDE_DIR JsonCpp_LIBRARY)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment