From ab0c0b83d4c87bec744f6e7fc2fbfee6d79d6933 Mon Sep 17 00:00:00 2001 From: jesperpedersen Date: Fri, 7 Jan 2022 10:56:10 -0500 Subject: [PATCH] Add math library --- CMakeLists.txt | 13 ++++++++----- src/CMakeLists.txt | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 07959d9..90f990d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,7 @@ message(STATUS "pgprtdbg ${VERSION_STRING}") include(CheckCCompilerFlag) include(CheckCSourceCompiles) +include(CheckLibraryExists) include(FindPackageHandleStandardArgs) include(GNUInstallDirs) @@ -58,11 +59,13 @@ endif() set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) -# if (THREADS_HAVE_PTHREAD_ARG) -# message(STATUS "pthreads found") -# else () -# message(FATAL_ERROR "pthreads needed") -# endif() + +CHECK_LIBRARY_EXISTS(m round "" HAVE_LIB_M) +if (HAVE_LIB_M) + set(EXTRA_LIBS ${EXTRA_LIBS} m) +else () + message(FATAL_ERROR "math needed") +endif (HAVE_LIB_M) file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/src/") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9ac0630..5b499da 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -20,6 +20,7 @@ include_directories( link_libraries( ${LIBEV_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} + ${EXTRA_LIBS} ) #