vcpkg/ports/liblinear/CMakeLists.txt

47 lines
1.0 KiB
CMake
Raw Normal View History

2018-04-11 01:56:24 +08:00
cmake_minimum_required(VERSION 3.9)
project(liblinear)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_library(blas OBJECT
blas/daxpy.c
blas/ddot.c
blas/dnrm2.c
blas/dscal.c
)
add_library(liblinear
linear.cpp
newton.cpp
2018-04-11 01:56:24 +08:00
$<TARGET_OBJECTS:blas>
)
target_include_directories(liblinear PRIVATE .)
if(BUILD_SHARED_LIBS)
target_link_libraries(liblinear PRIVATE "-DEF:${CMAKE_CURRENT_SOURCE_DIR}/linear.def")
endif()
add_executable(train train.c $<TARGET_OBJECTS:blas>)
target_link_libraries(train liblinear)
add_executable(predict predict.c $<TARGET_OBJECTS:blas>)
target_link_libraries(predict liblinear)
install(
TARGETS liblinear
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
if(NOT DISABLE_INSTALL_TOOLS)
install(
TARGETS train predict
RUNTIME DESTINATION tools/liblinear
)
endif()
if(NOT DISABLE_INSTALL_HEADERS)
install(
FILES linear.h newton.h
2018-04-11 01:56:24 +08:00
DESTINATION include/liblinear)
endif()