Open digital10111 opened 5 years ago
add_subdirectory can be used for build with MSVC 17 x64 compiler, C++11.
# CMakeLists.txt file
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(test)
# set(Boost_DEBUG 1) # for build debug
set(Boost_LIB_PREFIX lib) # check in ur boost root dir
set(Boost_COMPILER "-vc") #depends on ur compiler for boost install
add_subdirectory("path/to/kenlm")
add_library(lib_name STATIC ${sources})
target_include_directories(lib_name ${includes} ${Boost_INCLUDE_DIRS} path/to/kenlm)
target_link_libraries(lib_name kenlm ${other_libs})
add_executable(test ${src})
target_link_libraries(test lib_name)
set_property(TARGET test PROPERTY CXX_STANDARD 11)
Before building you need to install boost.
kenlm
require Eigen3, ZLIB, BZip2, LibLZMA
, but for my task i can build app without these dependencies (although i have a lot of errors on kenlm
building, but my app is builded)
And in ur project path:
mkdir build
cd build
cmake -G "Visual Studio 15 2017" -A x64 ..
cmake --build . --config Release
https://cmake.org/cmake/help/latest/module/ExternalProject.html