Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VTK
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Spiros Tsalikis
VTK
Commits
f7dfe9c9
Commit
f7dfe9c9
authored
6 years ago
by
Ben Boeckel
Browse files
Options
Downloads
Patches
Plain Diff
FindJsonCpp: add imported targets
parent
bbf5fdb8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CMake/FindJsonCpp.cmake
+32
-28
32 additions, 28 deletions
CMake/FindJsonCpp.cmake
with
32 additions
and
28 deletions
CMake/FindJsonCpp.cmake
+
32
−
28
View file @
f7dfe9c9
# Find the JsonCpp include files and library.
#
# JsonCpp is a C++ library that can read/write JSON (JavaScript Object Notation)
# documents. See http://jsoncpp.sourceforge.net/ for more details.
#
# This module defines:
# JsonCpp_INCLUDE_DIRS - where to find json/json.h
# JsonCpp_LIBRARIES - the libraries to link against to use JsonCpp
# JsonCpp_FOUND - if false the library was not found.
find_path
(
JsonCpp_INCLUDE_DIR
"json/json.h"
PATH_SUFFIXES
"jsoncpp"
DOC
"Specify the JsonCpp include directory here"
)
DOC
"jsoncpp include directory"
)
mark_as_advanced
(
JsonCpp_INCLUDE_DIR
)
find_library
(
JsonCpp_LIBRARY
NAMES jsoncpp
PATHS
DOC
"Specify the JsonCpp library here"
)
set
(
JsonCpp_INCLUDE_DIRS
${
JsonCpp_INCLUDE_DIR
}
)
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
"JSONCPP_VERSION_[A-Z]+"
)
foreach
(
_JsonCpp_version_part MAJOR MINOR PATCH
)
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
}
"
)
DOC
"jsoncpp library"
)
mark_as_advanced
(
JsonCpp_LIBRARY
)
set
(
_JsonCpp_version_args VERSION_VAR JsonCpp_VERSION_STRING
)
if
(
JsonCpp_INCLUDE_DIR AND EXISTS
"
${
JsonCpp_INCLUDE_DIR
}
/json/version.h"
)
file
(
STRINGS
"
${
JsonCpp_INCLUDE_DIR
}
/json/version.h"
_JsonCpp_version_lines
REGEX
"JSONCPP_VERSION_[A-Z]+"
)
string
(
REGEX REPLACE
".*# *define +JSONCPP_VERSION_MAJOR +([0-9]+).*"
"
\\
1"
_JsonCpp_version_major
"
${
_JsonCpp_version_lines
}
"
)
string
(
REGEX REPLACE
".*# *define +JSONCPP_VERSION_MINOR +([0-9]+).*"
"
\\
1"
_JsonCpp_version_minor
"
${
_JsonCpp_version_lines
}
"
)
string
(
REGEX REPLACE
".*# *define +JSONCPP_VERSION_PATCH +([0-9]+).*"
"
\\
1"
_JsonCpp_version_patch
"
${
_JsonCpp_version_lines
}
"
)
set
(
JsonCpp_VERSION
"
${
_JsonCpp_version_major
}
.
${
_JsonCpp_version_minor
}
.
${
_JsonCpp_version_patch
}
"
)
unset
(
_JsonCpp_version_major
)
unset
(
_JsonCpp_version_minor
)
unset
(
_JsonCpp_version_patch
)
unset
(
_JsonCpp_version_lines
)
endif
()
include
(
FindPackageHandleStandardArgs
)
find_package_handle_standard_args
(
JsonCpp
REQUIRED_VARS JsonCpp_LIBRAR
IES
JsonCpp_INCLUDE_DIR
S
${
_JsonCpp_version_args
}
)
REQUIRED_VARS JsonCpp_LIBRAR
Y
JsonCpp_INCLUDE_DIR
VERSION_VAR JsonCpp_VERSION
)
mark_as_advanced
(
JsonCpp_INCLUDE_DIR JsonCpp_LIBRARY
)
if
(
JsonCpp_FOUND
)
set
(
JsonCpp_INCLUDE_DIRS
"
${
JsonCpp_INCLUDE_DIR
}
"
)
set
(
JsonCpp_LIBRARIES
"
${
JsonCpp_LIBRARY
}
"
)
if
(
NOT TARGET JsonCpp::JsonCpp
)
include
(
vtkDetectLibraryType
)
vtk_detect_library_type
(
jsoncpp_library_type
PATH
"
${
JsonCpp_LIBRARY
}
"
)
add_library
(
JsonCpp::JsonCpp
"
${
jsoncpp_library_type
}
"
IMPORTED
)
unset
(
jsoncpp_library_type
)
set_target_properties
(
JsonCpp::JsonCpp PROPERTIES
IMPORTED_LOCATION
"
${
JsonCpp_LIBRARY
}
"
INTERFACE_INCLUDE_DIRECTORIES
"
${
JsonCpp_INCLUDE_DIR
}
"
)
endif
()
endif
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment