add config.cmake.in

This commit is contained in:
2021-08-28 12:42:28 +08:00
parent 69a4b33b8f
commit 3c1de9f322
5 changed files with 55 additions and 32 deletions

View File

@@ -1,18 +1,18 @@
cmake_minimum_required(VERSION 3.15.2)
# 设置工程名称和语言
project(LIBLBFGS VERSION 1.1.0)
project(LibLBFGS VERSION 1.1.0)
# 添加配置配件编写的函数
include(CMakePackageConfigHelpers)
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
set(CMAKE_INSTALL_PREFIX D:/Library)
else()
set(CMAKE_INSTALL_PREFIX /opt/stow/liblbfgs)
endif()
message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME})
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
#set(CMAKE_C_COMPILER gcc)
#set(CMAKE_CXX_COMPILER g++)
set(CMAKE_INSTALL_PREFIX D:/Library)
endif()
message(STATUS "Install prefix: " ${CMAKE_INSTALL_PREFIX})
# 添加源文件地址
add_subdirectory(src/)
message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
# 添加编译选项
option(HAVE_CONFIG_H "use config.h" ON)
@@ -23,3 +23,6 @@ configure_file(
"${PROJECT_SOURCE_DIR}/config.h.in"
"${PROJECT_SOURCE_DIR}/src/lib/config.h"
)
# 添加源文件地址
add_subdirectory(src/)