Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Root
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
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Admin message
为了安全,强烈建议开启2FA双因子认证:User Settings -> Account -> Enable two-factor authentication!!!
Show more breadcrumbs
cxwx
Root
Commits
8a4bc98f
Unverified
Commit
8a4bc98f
authored
7 years ago
by
Guilherme Amadio
Browse files
Options
Downloads
Patches
Plain Diff
Update FindLZ4.cmake
parent
b28c3828
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cmake/modules/FindLZ4.cmake
+52
-56
52 additions, 56 deletions
cmake/modules/FindLZ4.cmake
with
52 additions
and
56 deletions
cmake/modules/FindLZ4.cmake
+
52
−
56
View file @
8a4bc98f
# Find the LZ4 includes and library.
#.rst:
# FindLZ4
# -------
#
# This module defines
# LZ4_INCLUDE_DIR, where to locate LZ4 header files
# LZ4_LIBRARIES, the libraries to link against to use LZ4
# LZ4_FOUND. If false, you cannot build anything that requires LZ4.
# Find the LZ4 library header and define variables.
#
# Imported Targets
# ^^^^^^^^^^^^^^^^
#
# This module defines :prop_tgt:`IMPORTED` target ``LZ4::LZ4``,
# if LZ4 has been found
#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
# This module defines the following variables:
#
# ::
#
# LZ4_FOUND - True if LZ4 is found.
# LZ4_INCLUDE_DIRS - Where to find lz4.h
#
# ::
#
# LZ4_VERSION - The version of LZ4 found (x.y.z)
# LZ4_VERSION_MAJOR - The major version of LZ4
# LZ4_VERSION_MINOR - The minor version of LZ4
# LZ4_VERSION_PATCH - The patch version of LZ4
find_path
(
LZ4_INCLUDE_DIR NAME lz4.h PATH_SUFFIXES include
)
if
(
LZ4_CONFIG_EXECUTABLE
)
set
(
LZ4_FIND_QUIETLY 1
)
if
(
NOT LZ4_LIBRARY
)
find_library
(
LZ4_LIBRARY NAMES lz4 PATH_SUFFIXES lib
)
endif
()
set
(
LZ4_FOUND 0
)
find_path
(
LZ4_INCLUDE_DIR NAMES lz4.h PATHS
$ENV{LZ4_DIR}/include
/usr/include
/usr/local/include
/opt/lz4/include
DOC
"Specify the directory containing lz4.h"
)
mark_as_advanced
(
LZ4_INCLUDE_DIR
)
# Checking for xxhash library includes (part of https://github.com/lz4/lz4.git,
# but not provided in .deb and .rpm packages)
find_path
(
XXHASH_INCLUDE_DIR NAMES xxhash.h PATHS
/usr/include
/usr/local/include
/opt/xxhash/include
DOC
"Specify the directory containing xxhash.h"
)
if
(
LZ4_INCLUDE_DIR AND EXISTS
"
${
LZ4_INCLUDE_DIR
}
/lz4.h"
)
file
(
STRINGS
"
${
LZ4_INCLUDE_DIR
}
/lz4.h"
LZ4_H REGEX
"^#define LZ4_VERSION_[A-Z]+[ ]+[0-9]+.*$"
)
string
(
REGEX REPLACE
".+LZ4_VERSION_MAJOR[ ]+([0-9]+).*$"
"
\\
1"
LZ4_VERSION_MAJOR
"
${
LZ4_H
}
"
)
string
(
REGEX REPLACE
".+LZ4_VERSION_MINOR[ ]+([0-9]+).*$"
"
\\
1"
LZ4_VERSION_MINOR
"
${
LZ4_H
}
"
)
string
(
REGEX REPLACE
".+LZ4_VERSION_RELEASE[ ]+([0-9]+).*$"
"
\\
1"
LZ4_VERSION_PATCH
"
${
LZ4_H
}
"
)
set
(
LZ4_VERSION
"
${
LZ4_VERSION_MAJOR
}
.
${
LZ4_VERSION_MINOR
}
.
${
LZ4_VERSION_PATCH
}
"
)
endif
()
find_library
(
LZ4_LIBRARY NAMES lz4 PATHS
$ENV{LZ4_DIR}/lib
/usr/local/lz4/lib
/usr/local/lib
/usr/lib/lz4
/usr/local/lib/lz4
/usr/lz4/lib /usr/lib
/usr/lz4 /usr/local/lz4
/opt/lz4 /opt/lz4/lib
DOC
"Specify the lz4 library here."
)
include
(
FindPackageHandleStandardArgs
)
find_package_handle_standard_args
(
LZ4
REQUIRED_VARS LZ4_LIBRARY LZ4_INCLUDE_DIR VERSION_VAR LZ4_VERSION
)
# Checking for xxhash library, in case it was built separately from
# https://github.com/Cyan4973/xxHash.git
find_library
(
XXHASH_LIBRARY NAMES xxhash PATHS
/usr/local/lib
/usr/lib
DOC
"Specify the xxhash library here."
)
if
(
LZ4_FOUND
)
set
(
LZ4_INCLUDE_DIRS
"
${
LZ4_INCLUDE_DIR
}
"
)
if
(
LZ4_INCLUDE_DIR AND LZ4_LIBRARY AND XXHASH_INCLUDE_DIR
)
set
(
LZ4_FOUND 1
)
if
(
NOT LZ4_FIND_QUIETLY
)
message
(
STATUS
"Found LZ4 includes at
${
LZ4_INCLUDE_DIR
}
"
)
message
(
STATUS
"Found LZ4 library at
${
LZ4_LIBRARY
}
"
)
message
(
STATUS
"Found xxhash include at
${
XXHASH_INCLUDE_DIR
}
"
)
if
(
NOT LZ4_LIBRARIES
)
set
(
LZ4_LIBRARIES
${
LZ4_LIBRARY
}
)
endif
()
endif
()
set
(
LZ4_LIBRARIES
${
LZ4_LIBRARY
}
)
if
(
XXHASH_LIBRARY
)
list
(
APPEND LZ4_LIBRARIES
${
XXHASH_LIBRARY
}
)
endif
()
if
(
NOT
(
"
${
XXHASH
_INCLUDE_DIR
}
"
MATCH
ES
${
LZ4_INCLUDE_DIR
}
)
)
list
(
APPEND LZ4_INCLUDE_DIR
${
XXHASH_INCLUDE_DIR
}
)
if
(
NOT TARGET LZ4::LZ4
)
add_library
(
LZ4::LZ4 UNKNOWN IMPORTED
)
set_target_properties
(
LZ4::LZ4 PROPERTIES
IMPORTED_LOCATION
"
${
LZ4_LIBRARY
}
"
INTERFACE
_INCLUDE_DIR
ECTORI
ES
"
${
LZ4_INCLUDE_DIR
S
}
"
)
endif
(
)
endif
()
mark_as_advanced
(
LZ4_FOUND LZ4_LIBRARY LZ4_INCLUDE_DIR XXHASH_INCLUDE_DIR
)
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