C++ 使用cmake和travis的Boost 1.67静态库
大家好。 我尝试用cmake和travis ci中的boost 1.67构建我的c++项目。 下面是源文件 在我的linux计算机上,从源代码安装了cmake 3.13.4,从源代码安装了boost-1.67,所有静态和动态库都在目录/usr/local/lib/中,所有库都可以正常工作。但在travis ci中,我每次都看到这样的信息:C++ 使用cmake和travis的Boost 1.67静态库,c++,boost,cmake,travis-ci,C++,Boost,Cmake,Travis Ci,大家好。 我尝试用cmake和travis ci中的boost 1.67构建我的c++项目。 下面是源文件 在我的linux计算机上,从源代码安装了cmake 3.13.4,从源代码安装了boost-1.67,所有静态和动态库都在目录/usr/local/lib/中,所有库都可以正常工作。但在travis ci中,我每次都看到这样的信息: Unable to find the requested Boost libraries. Boost version: 1.67.0 Boost i
Unable to find the requested Boost libraries.
Boost version: 1.67.0
Boost include path: /usr/include
Could not find the following static Boost libraries:
boost_program_options
No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the
directory containing Boost libraries or BOOST_ROOT to the location of
Boost.
yml文件:
language: cpp
dist: xenial
sudo: false
os: linux
matrix:
include:
- env: COMPILER=g++-8 BUILD=Debug STANDARD=14
compiler: gcc
addons:
apt:
update: true
sources:
- sourceline: 'ppa:mhier/libboost-latest'
- ubuntu-toolchain-r-test
packages:
- g++-8
- boost1.67
- env: COMPILER=g++-8 BUILD=Release STANDARD=14
compiler: gcc
addons:
apt:
update: true
sources:
- sourceline: 'ppa:mhier/libboost-latest'
- ubuntu-toolchain-r-test
packages:
- g++-8
- boost1.67
before_script:
- wget https://cmake.org/files/v3.13/cmake-3.13.4-Linux-x86_64.sh
- sudo sh cmake-3.13.4-Linux-x86_64.sh -- --skip-license --prefix=/usr
script:
- cmake .
- cmake --build .
- cmake --build . --target package
cmake:
cmake_minimum_required(VERSION 3.10)
project(hcch VERSION 0.1.${VERSION_BUILD})
set(BOOST_ROOT /usr/include/boost/)
# For my linux
#set(BOOST_LIBRARYDIR /usr/local/lib)
# For travis-ci host
set(BOOST_LIBRARYDIR /usr/lib/x86_64-linux-gnu)
set(Boost_USE_STATIC_LIBS ON)
include_directories (${Boost_INCLUDE_DIRS})
link_directories (${Boost_LIBRARY_DIRS})
find_package(Boost 1.67 COMPONENTS program_options REQUIRED)
find_package(LLVM REQUIRED CONFIG)
configure_file (
"${PROJECT_SOURCE_DIR}/version.h.in"
"${PROJECT_BINARY_DIR}/version.h"
)
set(CMAKE_CXX_STANDARD 14)
add_executable(hcch hcch.cpp SourcesCreator.cpp SourcesCreator.h)
set_target_properties(hcch PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED ON
COMPILE_OPTIONS -Wpedantic -Wall -Wextra
)
TARGET_LINK_LIBRARIES( hcch ${BOOST_LIBRARYDIR}/libboost_program_options.a )
可能静态库不是从ppa安装的:mhier/libboost最新版本?
如果有人遇到,告诉我怎么修理
这是我的项目
关于这一点,max我可以确认,ppa:mhier/libboost-latest中的libboost版本当前未构建静态库,仅共享 如果必须使用比libboost-all-dev提供的版本更晚的Boost版本,那么您将需要从源代码处编译Boost,尽管您将面临超时的风险。有关此操作的说明,请参见