2011-09-06 19:07:55 +00:00
|
|
|
# Once done, this will define
|
|
|
|
#
|
|
|
|
# LIBC_FOUND - system has libc
|
|
|
|
# LIBC_LIBRARIES - link these to use libc
|
|
|
|
|
|
|
|
if(LIBC_LIBRARIES)
|
2021-07-04 05:24:21 +00:00
|
|
|
set(LIBC_FIND_QUIETLY TRUE)
|
2011-09-06 19:07:55 +00:00
|
|
|
endif(LIBC_LIBRARIES)
|
|
|
|
|
|
|
|
find_library(libm NAMES m)
|
2015-11-17 19:09:33 +00:00
|
|
|
|
|
|
|
# OSX doesn't have rt. On Linux timer and aio dependency.
|
|
|
|
if(APPLE)
|
2016-05-01 09:14:44 +00:00
|
|
|
find_library(libdl NAMES dl)
|
2015-11-17 19:09:33 +00:00
|
|
|
set(LIBC_LIBRARIES ${librt} ${libdl} ${libm})
|
2016-05-01 09:14:44 +00:00
|
|
|
elseif(Linux)
|
|
|
|
find_library(libdl NAMES dl)
|
2015-11-17 19:09:33 +00:00
|
|
|
find_library(librt NAMES rt)
|
|
|
|
set(LIBC_LIBRARIES ${librt} ${libdl} ${libm})
|
2016-05-01 09:14:44 +00:00
|
|
|
else()
|
|
|
|
# FreeBSD doesn't have libdl
|
|
|
|
find_library(librt NAMES rt)
|
|
|
|
set(LIBC_LIBRARIES ${librt} ${libm})
|
2015-11-17 19:09:33 +00:00
|
|
|
endif()
|
2011-09-06 19:07:55 +00:00
|
|
|
|
|
|
|
# handle the QUIETLY and REQUIRED arguments and set LIBC_FOUND to TRUE if
|
|
|
|
# all listed variables are TRUE
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(Libc DEFAULT_MSG LIBC_LIBRARIES)
|
|
|
|
|
|
|
|
mark_as_advanced(LIBC_LIBRARIES)
|
|
|
|
|