Re-sync with internal repository
[hiphop-php.git] / third-party / folly / src / CMake / FindLibDwarf.cmake
blob9cffdc1ba97fcfaeae6e915a13f264c169e5703c
1 # Copyright (c) Meta Platforms, Inc. and affiliates.
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
7 #     http://www.apache.org/licenses/LICENSE-2.0
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.
15 # dwarf.h is typically installed in a libdwarf/ subdirectory on Debian-style
16 # Linux distributions.  It is not installed in a libdwarf/ subdirectory on Mac
17 # systems when installed with Homebrew.  Search for it in both locations.
18 find_path(LIBDWARF_INCLUDE_DIR NAMES dwarf.h PATH_SUFFIXES libdwarf)
19 mark_as_advanced(LIBDWARF_INCLUDE_DIR)
21 find_library(LIBDWARF_LIBRARY NAMES dwarf)
22 mark_as_advanced(LIBDWARF_LIBRARY)
24 include(FindPackageHandleStandardArgs)
25 FIND_PACKAGE_HANDLE_STANDARD_ARGS(
26   LIBDWARF
27   REQUIRED_VARS LIBDWARF_LIBRARY LIBDWARF_INCLUDE_DIR)
29 if(LIBDWARF_FOUND)
30   set(LIBDWARF_LIBRARIES ${LIBDWARF_LIBRARY})
31   set(LIBDWARF_INCLUDE_DIRS ${LIBDWARF_INCLUDE_DIR})
32 endif()