-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
122 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# - Try to find libelf | ||
# Once done this will define | ||
# | ||
# LIBELF_FOUND - system has libelf | ||
# LIBELF_INCLUDE_DIRS - the libelf include directory | ||
# LIBELF_LIBRARIES - Link these to use libelf | ||
# LIBELF_DEFINITIONS - Compiler switches required for using libelf | ||
# | ||
# Copyright (c) 2008 Bernhard Walle <[email protected]> | ||
# | ||
# Redistribution and use is allowed according to the terms of the New | ||
# BSD license. | ||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file. | ||
# | ||
|
||
|
||
if (LIBELF_LIBRARIES AND LIBELF_INCLUDE_DIRS) | ||
set (LibElf_FIND_QUIETLY TRUE) | ||
endif (LIBELF_LIBRARIES AND LIBELF_INCLUDE_DIRS) | ||
|
||
find_path (LIBELF_INCLUDE_DIRS | ||
NAMES | ||
libelf.h | ||
PATHS | ||
/usr/include | ||
/usr/include/libelf | ||
/usr/local/include | ||
/usr/local/include/libelf | ||
/opt/local/include | ||
/opt/local/include/libelf | ||
/sw/include | ||
/sw/include/libelf | ||
ENV CPATH) | ||
|
||
find_library (LIBELF_LIBRARIES | ||
NAMES | ||
elf | ||
PATHS | ||
/usr/lib | ||
/usr/local/lib | ||
/opt/local/lib | ||
/sw/lib | ||
ENV LIBRARY_PATH | ||
ENV LD_LIBRARY_PATH) | ||
|
||
get_filename_component(LIBELF_LIBRARIES_PATH ${LIBELF_LIBRARIES} DIRECTORY) | ||
|
||
include (FindPackageHandleStandardArgs) | ||
|
||
|
||
# handle the QUIETLY and REQUIRED arguments and set LIBELF_FOUND to TRUE if all listed variables are TRUE | ||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibElf DEFAULT_MSG | ||
LIBELF_LIBRARIES | ||
LIBELF_INCLUDE_DIRS) | ||
|
||
SET(CMAKE_REQUIRED_LIBRARIES elf) | ||
INCLUDE(CheckCXXSourceCompiles) | ||
CHECK_CXX_SOURCE_COMPILES("#include <libelf.h> | ||
int main() { | ||
Elf *e = (Elf*)0; | ||
size_t sz; | ||
elf_getshdrstrndx(e, &sz); | ||
return 0; | ||
}" ELF_GETSHDRSTRNDX) | ||
|
||
mark_as_advanced(LIBELF_INCLUDE_DIRS LIBELF_LIBRARIES ELF_GETSHDRSTRNDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#*************************************************************************** | ||
# _ _ ____ _ | ||
# Project ___| | | | _ \| | | ||
# / __| | | | |_) | | | ||
# | (__| |_| | _ <| |___ | ||
# \___|\___/|_| \_\_____| | ||
# | ||
# Copyright (C) 1998 - 2022, Daniel Stenberg, <[email protected]>, et al. | ||
# | ||
# This software is licensed as described in the file COPYING, which | ||
# you should have received as part of this distribution. The terms | ||
# are also available at https://curl.se/docs/copyright.html. | ||
# | ||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell | ||
# copies of the Software, and permit persons to whom the Software is | ||
# furnished to do so, under the terms of the COPYING file. | ||
# | ||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
# KIND, either express or implied. | ||
# | ||
# SPDX-License-Identifier: curl | ||
# | ||
########################################################################### | ||
find_path(MBEDTLS_INCLUDE_DIRS mbedtls/md5.h) | ||
|
||
find_library(MBEDTLS_LIBRARY mbedtls) | ||
# find_library(MBEDX509_LIBRARY mbedx509) | ||
find_library(MBEDCRYPTO_LIBRARY mbedcrypto) | ||
|
||
get_filename_component(MBEDCRYPTO_LIBRARY_PATH ${MBEDCRYPTO_LIBRARY} DIRECTORY) | ||
get_filename_component(MBEDTLS_LIBRARY_PATH ${MBEDTLS_LIBRARY} DIRECTORY) | ||
|
||
|
||
set(MBEDTLS_LIBRARIES "${MBEDTLS_LIBRARY}" "${MBEDX509_LIBRARY}" "${MBEDCRYPTO_LIBRARY}") | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(MbedTLS DEFAULT_MSG | ||
MBEDTLS_INCLUDE_DIRS MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY) | ||
|
||
mark_as_advanced(MBEDTLS_INCLUDE_DIRS MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY) |