if (NOT APPLE) find_library(LIBRT_LIBRARIES rt) if (NOT LIBRT_LIBRARIES) message(FATAL_ERROR "Could not find librt") endif () else () set(LIBRT_LIBRARIES "") endif () find_library(LIBPTHREAD_LIBRARIES pthread) if (NOT LIBPTHREAD_LIBRARIES) message(FATAL_ERROR "Could not find libpthread") endif () find_library(LIBM_LIBRARIES m) if (NOT LIBM_LIBRARIES) message(FATAL_ERROR "Could not find libm") endif () mark_as_advanced(LIBRT_LIBRARIES LIBPTHREAD_LIBRARIES LIBM_LIBRARIES)