X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=CMakeLists.txt;h=e50f3be3b61546f1629591194087d79233b70b73;hb=aea49a24c79cb6fd4ade8861ebc6e675d74f1c57;hp=ddcaa060f4242e835cfc42c784fde95e0a7e456d;hpb=2dad0d39a5d195f209ba01da70bfa901cbe87e12;p=nlopt.git 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)