From aea49a24c79cb6fd4ade8861ebc6e675d74f1c57 Mon Sep 17 00:00:00 2001 From: Julien Schueller Date: Fri, 4 Nov 2016 09:55:31 +0100 Subject: [PATCH] Detect libm --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ddcaa06..e50f3be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,6 +72,7 @@ include (CheckTypeSize) include (CheckCCompilerFlag) include (CheckCXXSymbolExists) include (CheckCXXCompilerFlag) +include (CheckLibraryExists) #============================================================================== # COMPILATION CHECKINGS and CONFIGURATION GENERATION @@ -105,6 +106,11 @@ set (HAVE_UINT32_T ${SIZEOF_UINT32_T}) check_type_size ("unsigned int" SIZEOF_UNSIGNED_INT) check_type_size ("unsigned long" SIZEOF_UNSIGNED_LONG) +check_library_exists ("m" sqrt "" HAVE_LIBM) +if (HAVE_LIBM) + set (M_LIBRARY m) +endif() + if (NOT DEFINED HAVE_FPCLASSIFY) message(STATUS "Looking for fpclassify") file (WRITE ${CMAKE_BINARY_DIR}/fpclassify.c "#include \n") @@ -234,6 +240,8 @@ install (FILES ${NLOPT_HEADERS} DESTINATION ${INSTALL_INCLUDE_DIR}) set (nlopt_lib nlopt${NLOPT_SUFFIX}) add_library (${nlopt_lib} ${NLOPT_SOURCES}) +target_link_libraries (${nlopt_lib} ${M_LIBRARY}) + set_target_properties (${nlopt_lib} PROPERTIES SOVERSION 0) set_target_properties (${nlopt_lib} PROPERTIES VERSION 0.9.0) -- 2.30.2