diff --git a/CMakeLists.txt b/CMakeLists.txt index 87c68a8..1fcda4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required(VERSION 3.15.2) -# 设置cxx编译器 -# 如果你使用别的编译器,请在这里修改 -#set(CMAKE_C_COMPILER /usr/local/bin/gcc-9) -#set(CMAKE_CXX_COMPILER /usr/local/bin/g++-9) + # 设置工程名称和语言 project(LIBLBFGS VERSION 1.1.0) # 设置安装地址 改用homebrew安装后这一句就不需要了 @@ -17,4 +14,4 @@ configure_file( "${PROJECT_SOURCE_DIR}/src/lib/config.h" ) # 添加源文件地址 -add_subdirectory(src/) \ No newline at end of file +add_subdirectory(src/) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fd5cbfe..64124ae 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,9 +17,9 @@ set_target_properties(lbfgs PROPERTIES VERSION 1.1 SOVERSION 1.1) # 设置库文件的输出地址 set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) # 在LINUX中需添加math库 -message("Operating system: ${CMAKE_SYSTEM}") -if(UNIX) - message("Linking math library.") +message("-- Operating system: ${CMAKE_SYSTEM}") +if(UNIX AND NOT APPLE) + message("-- Linking math library.") find_library(MATH_LIBRARY m) find_library(MATH_A_LIBRARY libm.a) target_link_libraries(lbfgs PUBLIC ${MATH_LIBRARY})