FindZstd.cmake (1361B)
1 # Copyright (c) Meta Platforms, Inc. and affiliates. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 # 16 # - Try to find Facebook zstd library 17 # This will define 18 # Zstd_FOUND 19 # Zstd_INCLUDE_DIR 20 # Zstd_LIBRARY 21 # 22 23 find_path(Zstd_INCLUDE_DIR NAMES zstd.h) 24 25 find_library(Zstd_LIBRARY_DEBUG NAMES zstdd zstd_staticd) 26 find_library(Zstd_LIBRARY_RELEASE NAMES zstd zstd_static) 27 28 include(SelectLibraryConfigurations) 29 SELECT_LIBRARY_CONFIGURATIONS(Zstd) 30 31 include(FindPackageHandleStandardArgs) 32 FIND_PACKAGE_HANDLE_STANDARD_ARGS( 33 Zstd DEFAULT_MSG 34 Zstd_LIBRARY Zstd_INCLUDE_DIR 35 ) 36 37 mark_as_advanced(Zstd_INCLUDE_DIR Zstd_LIBRARY) 38 39 if(Zstd_FOUND AND NOT (TARGET Zstd::Zstd)) 40 add_library (Zstd::Zstd UNKNOWN IMPORTED) 41 set_target_properties(Zstd::Zstd 42 PROPERTIES 43 IMPORTED_LOCATION ${Zstd_LIBRARY} 44 INTERFACE_INCLUDE_DIRECTORIES ${Zstd_INCLUDE_DIR}) 45 endif()