1 #[=======================================================================[.rst:
10 This will define the following variables:
13 True if the system has the LZO library.
15 Include directories needed to use LZO.
17 Libraries needed to link to LZO.
19 The version of the LZO library which was found.
24 The following cache variables may also be set:
27 The directory containing ``lzo/lzo1x.h``.
29 The path to the LZO library.
31 #]=======================================================================]
33 find_package(PkgConfig QUIET)
34 pkg_check_modules(PC_LZO QUIET lzo2)
36 find_path(LZO_INCLUDE_DIR
38 PATHS ${PC_LZO_INCLUDE_DIRS}
41 find_library(LZO_LIBRARY
43 PATHS ${PC_LZO_LIBRARY_DIRS}
46 # With vcpkg, the library path should contain both 'debug' and 'optimized'
47 # entries (see target_link_libraries() documentation for more information)
49 # NOTE: we only patch up when using vcpkg; the same issue might happen
50 # when not using vcpkg, but this is non-trivial to fix, as we have no idea
51 # what the paths are. With vcpkg we do. And we only official support vcpkg
54 # NOTE: this is based on the assumption that the debug file has the same
55 # name as the optimized file. This is not always the case, but so far
56 # experiences has shown that in those case vcpkg CMake files do the right
58 if(VCPKG_TOOLCHAIN AND LZO_LIBRARY AND LZO_LIBRARY MATCHES "${VCPKG_INSTALLED_DIR}")
59 if(LZO_LIBRARY MATCHES "/debug/")
60 set(LZO_LIBRARY_DEBUG ${LZO_LIBRARY})
61 string(REPLACE "/debug/lib/" "/lib/" LZO_LIBRARY_RELEASE ${LZO_LIBRARY})
63 set(LZO_LIBRARY_RELEASE ${LZO_LIBRARY})
64 string(REPLACE "/lib/" "/debug/lib/" LZO_LIBRARY_DEBUG ${LZO_LIBRARY})
66 include(SelectLibraryConfigurations)
67 select_library_configurations(LZO)
70 set(LZO_VERSION ${PC_LZO_VERSION})
72 include(FindPackageHandleStandardArgs)
73 find_package_handle_standard_args(LZO
78 VERSION_VAR LZO_VERSION
82 set(LZO_LIBRARIES ${LZO_LIBRARY})
83 set(LZO_INCLUDE_DIRS ${LZO_INCLUDE_DIR})