@@ -11,10 +11,10 @@ Use this module by invoking find_package with the form::
1111
1212.. code-block:: cmake
1313
14- find_package(LZ4
15- [version] # Minimum version e.g. 1.8.0
16- [REQUIRED] # Fail with error if LZ4 is not found
17- )
14+ find_package(LZ4
15+ [version] # Minimum version e.g. 1.8.0
16+ [REQUIRED] # Fail with error if LZ4 is not found
17+ )
1818
1919Imported targets
2020^^^^^^^^^^^^^^^^
@@ -23,26 +23,26 @@ This module defines the following :prop_tgt:`IMPORTED` targets:
2323
2424.. variable:: lz4::lz4
2525
26- Imported target for using the LZ4 library, if found.
26+ Imported target for using the LZ4 library, if found.
2727
2828Result variables
2929^^^^^^^^^^^^^^^^
3030
3131.. variable:: LZ4_FOUND
3232
33- Set to true if LZ4 library found, otherwise false or undefined.
33+ Set to true if LZ4 library found, otherwise false or undefined.
3434
3535.. variable:: LZ4_INCLUDE_DIRS
3636
37- Paths to include directories listed in one variable for use by LZ4 client.
37+ Paths to include directories listed in one variable for use by LZ4 client.
3838
3939.. variable:: LZ4_LIBRARIES
4040
41- Paths to libraries to linked against to use LZ4.
41+ Paths to libraries to linked against to use LZ4.
4242
4343.. variable:: LZ4_VERSION
4444
45- The version string of LZ4 found.
45+ The version string of LZ4 found.
4646
4747Cache variables
4848^^^^^^^^^^^^^^^
@@ -52,11 +52,11 @@ reads hints about search locations from the following variables::
5252
5353.. variable:: LZ4_INCLUDE_DIR
5454
55- Path to LZ4 include directory with ``lz4.h`` header.
55+ Path to LZ4 include directory with ``lz4.h`` header.
5656
5757.. variable:: LZ4_LIBRARY
5858
59- Path to LZ4 library to be linked.
59+ Path to LZ4 library to be linked.
6060
6161NOTE: The variables above should not usually be used in CMakeLists.txt files!
6262
@@ -65,35 +65,35 @@ NOTE: The variables above should not usually be used in CMakeLists.txt files!
6565### Find library ##############################################################
6666
6767if (NOT LZ4_LIBRARY)
68- find_library (LZ4_LIBRARY_RELEASE NAMES lz4)
69- find_library (LZ4_LIBRARY_DEBUG NAMES lz4d)
68+ find_library (LZ4_LIBRARY_RELEASE NAMES lz4)
69+ find_library (LZ4_LIBRARY_DEBUG NAMES lz4d)
7070
71- include (SelectLibraryConfigurations)
72- select_library_configurations(LZ4)
71+ include (SelectLibraryConfigurations)
72+ select_library_configurations(LZ4)
7373else ()
74- file (TO_CMAKE_PATH "${LZ4_LIBRARY} " LZ4_LIBRARY)
74+ file (TO_CMAKE_PATH "${LZ4_LIBRARY} " LZ4_LIBRARY)
7575endif ()
7676
7777### Find include directory ####################################################
7878find_path (LZ4_INCLUDE_DIR NAMES lz4.h)
7979
8080if (LZ4_INCLUDE_DIR AND EXISTS "${LZ4_INCLUDE_DIR} /lz4.h" )
81- file (STRINGS "${LZ4_INCLUDE_DIR} /lz4.h" _lz4_h_contents
82- REGEX "#define LZ4_VERSION_[A-Z]+[ ]+[0-9]+" )
83- string (REGEX REPLACE "#define LZ4_VERSION_MAJOR[ ]+([0-9]+).+" "\\ 1"
84- LZ4_VERSION_MAJOR "${_lz4_h_contents} " )
85- string (REGEX REPLACE ".+#define LZ4_VERSION_MINOR[ ]+([0-9]+).+" "\\ 1"
86- LZ4_VERSION_MINOR "${_lz4_h_contents} " )
87- string (REGEX REPLACE ".+#define LZ4_VERSION_RELEASE[ ]+([0-9]+).*" "\\ 1"
88- LZ4_VERSION_RELEASE "${_lz4_h_contents} " )
89- set (LZ4_VERSION "${LZ4_VERSION_MAJOR} .${LZ4_VERSION_MINOR} .${LZ4_VERSION_RELEASE} " )
90- unset (_lz4_h_contents)
81+ file (STRINGS "${LZ4_INCLUDE_DIR} /lz4.h" _lz4_h_contents
82+ REGEX "#define LZ4_VERSION_[A-Z]+[ ]+[0-9]+" )
83+ string (REGEX REPLACE "#define LZ4_VERSION_MAJOR[ ]+([0-9]+).+" "\\ 1"
84+ LZ4_VERSION_MAJOR "${_lz4_h_contents} " )
85+ string (REGEX REPLACE ".+#define LZ4_VERSION_MINOR[ ]+([0-9]+).+" "\\ 1"
86+ LZ4_VERSION_MINOR "${_lz4_h_contents} " )
87+ string (REGEX REPLACE ".+#define LZ4_VERSION_RELEASE[ ]+([0-9]+).*" "\\ 1"
88+ LZ4_VERSION_RELEASE "${_lz4_h_contents} " )
89+ set (LZ4_VERSION "${LZ4_VERSION_MAJOR} .${LZ4_VERSION_MINOR} .${LZ4_VERSION_RELEASE} " )
90+ unset (_lz4_h_contents)
9191endif ()
9292
9393### Set result variables ######################################################
9494include (FindPackageHandleStandardArgs)
9595find_package_handle_standard_args(LZ4 DEFAULT_MSG
96- LZ4_LIBRARY LZ4_INCLUDE_DIR LZ4_VERSION)
96+ LZ4_LIBRARY LZ4_INCLUDE_DIR LZ4_VERSION)
9797
9898mark_as_advanced (LZ4_INCLUDE_DIR LZ4_LIBRARY)
9999
@@ -102,29 +102,29 @@ set(LZ4_INCLUDE_DIRS ${LZ4_INCLUDE_DIR})
102102
103103### Import targets ############################################################
104104if (LZ4_FOUND)
105- if (NOT TARGET lz4::lz4)
106- add_library (lz4::lz4 UNKNOWN IMPORTED )
107- set_target_properties (lz4::lz4 PROPERTIES
108- IMPORTED_LINK_INTERFACE_LANGUAGES "C"
109- INTERFACE_INCLUDE_DIRECTORIES "${LZ4_INCLUDE_DIR} " )
110-
111- if (LZ4_LIBRARY_RELEASE)
112- set_property (TARGET lz4::lz4 APPEND PROPERTY
113- IMPORTED_CONFIGURATIONS RELEASE)
114- set_target_properties (lz4::lz4 PROPERTIES
115- IMPORTED_LOCATION_RELEASE "${LZ4_LIBRARY_RELEASE} " )
116- endif ()
117-
118- if (LZ4_LIBRARY_DEBUG)
119- set_property (TARGET lz4::lz4 APPEND PROPERTY
120- IMPORTED_CONFIGURATIONS DEBUG)
121- set_target_properties (lz4::lz4 PROPERTIES
122- IMPORTED_LOCATION_DEBUG "${LZ4_LIBRARY_DEBUG} " )
123- endif ()
124-
125- if (NOT LZ4_LIBRARY_RELEASE AND NOT LZ4_LIBRARY_DEBUG)
126- set_property (TARGET lz4::lz4 APPEND PROPERTY
127- IMPORTED_LOCATION "${LZ4_LIBRARY} " )
128- endif ()
129- endif ()
105+ if (NOT TARGET lz4::lz4)
106+ add_library (lz4::lz4 UNKNOWN IMPORTED )
107+ set_target_properties (lz4::lz4 PROPERTIES
108+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
109+ INTERFACE_INCLUDE_DIRECTORIES "${LZ4_INCLUDE_DIR} " )
110+
111+ if (LZ4_LIBRARY_RELEASE)
112+ set_property (TARGET lz4::lz4 APPEND PROPERTY
113+ IMPORTED_CONFIGURATIONS RELEASE)
114+ set_target_properties (lz4::lz4 PROPERTIES
115+ IMPORTED_LOCATION_RELEASE "${LZ4_LIBRARY_RELEASE} " )
116+ endif ()
117+
118+ if (LZ4_LIBRARY_DEBUG)
119+ set_property (TARGET lz4::lz4 APPEND PROPERTY
120+ IMPORTED_CONFIGURATIONS DEBUG)
121+ set_target_properties (lz4::lz4 PROPERTIES
122+ IMPORTED_LOCATION_DEBUG "${LZ4_LIBRARY_DEBUG} " )
123+ endif ()
124+
125+ if (NOT LZ4_LIBRARY_RELEASE AND NOT LZ4_LIBRARY_DEBUG)
126+ set_property (TARGET lz4::lz4 APPEND PROPERTY
127+ IMPORTED_LOCATION "${LZ4_LIBRARY} " )
128+ endif ()
129+ endif ()
130130endif ()
0 commit comments