2017-06-22 56 views
0

我试图让我的项目cmake句柄依赖关系, 但似乎cmake无法找到提升我的系统。为什么不能cmake findBoost查找系统升压路径?

cmake_minimum_required(VERSION 3.8) 
project(QuineMccluskeyExample) 

set(CMAKE_CXX_STANDARD 14) 

if(MSVC) 
    set(CMAKE_CXX_FLAGS "/WX- /Wall /O2 /Ob2") 
else() 
    set(CMAKE_CXX_FLAGS "-pthread -Wall -O3") 
endif() 

# header only library 
add_library(QuineMccluskey INTERFACE) 
target_include_directories(QuineMccluskey INTERFACE include/) 

# example project source directories 
set(EXAMPLES ${PROJECT_SOURCE_DIR}/examples) 

set(SOURCE_FILES 
    ${EXAMPLES}/main.cpp) 


# Boost dependency 
find_package(Boost 1.63.0 COMPONENTS REQUIRED 
    dynamic_bitset 
    config 
    core 
    move 
    static_assert 
    assert 
    exception 
    integer) 

if(Boost_FOUND) 
    message("found BOOST: " ${BOOST_ROOT}) 
    include_directories(${Boost_INCLUDE_DIR}) 
    add_executable(QuineMccluskeyExample ${SOURCE_FILES}) 
else() 
    message("couldn't find boost") 
endif() 

这是我的CMakeLists.txt文件 及以下cmake的输出日志

Boost version: 1.64.0 

    Boost include path: /usr/include 

    Could not find the following Boost libraries: 

      boost_dynamic_bitset 
      boost_config 
      boost_core 
      boost_move 
      boost_static_assert 
      boost_assert 
      boost_integer 

    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. 

以上就是让findBoost找我的系统路径的结果。 我的系统路径是/ usr/include/boost cmake说它找到的路径是正确的。 我检查了所有需要的依赖项标题, 但由于某种原因,cmake无法找到它们。

手动提供-DBOOST_ROOT =“/ usr/include”取得了相同的结果。

低于

是/ usr/include中/升压

accumulators     math 
algorithm      math_fwd.hpp 
align       mem_fn.hpp 
aligned_storage.hpp   memory_order.hpp 
align.hpp      metaparse 
any.hpp      metaparse.hpp 
archive      move 
array.hpp      mpi 
asio       mpi.hpp 
asio.hpp      mpl 
assert.hpp     msm 
assign      multi_array 
assign.hpp     multi_array.hpp 
atomic      multi_index 
atomic.hpp     multi_index_container_fwd.hpp 
bimap       multi_index_container.hpp 
bimap.hpp      multiprecision 
bind       next_prior.hpp 
bind.hpp      noncopyable.hpp 
blank_fwd.hpp     nondet_random.hpp 
blank.hpp      none.hpp 
call_traits.hpp    none_t.hpp 
cast.hpp      non_type.hpp 
cerrno.hpp     numeric 
checked_delete.hpp   operators.hpp 
chrono      operators_v1.hpp 
chrono.hpp     optional 
circular_buffer    optional.hpp 
circular_buffer_fwd.hpp  parameter 
circular_buffer.hpp   parameter.hpp 
compatibility     pending 
compressed_pair.hpp   phoenix 
compute      phoenix.hpp 
compute.hpp     pointee.hpp 
concept      pointer_cast.hpp 
concept_archetype.hpp   pointer_to_other.hpp 
concept_check     polygon 
concept_check.hpp    polymorphic_cast.hpp 
config      polymorphic_pointer_cast.hpp 
config.hpp     pool 
container      predef 
context      predef.h 
convert      preprocessor 
convert.hpp     preprocessor.hpp 
core       process 
coroutine      process.hpp 
coroutine2     program_options 
crc.hpp      program_options.hpp 
cregex.hpp     progress.hpp 
cstdfloat.hpp     property_map 
cstdint.hpp     property_tree 
cstdlib.hpp     proto 
current_function.hpp   ptr_container 
cxx11_char_types.hpp   python 
date_time      python.hpp 
date_time.hpp     qvm 
detail      random 
dll       random.hpp 
dll.hpp      range 
dynamic_bitset    range.hpp 
dynamic_bitset_fwd.hpp  ratio 
dynamic_bitset.hpp   ratio.hpp 
enable_shared_from_this.hpp rational.hpp 
endian      ref.hpp 
exception      regex 
exception_ptr.hpp    regex_fwd.hpp 
fiber       regex.h 
filesystem     regex.hpp 
filesystem.hpp    scoped_array.hpp 
flyweight      scoped_ptr.hpp 
flyweight.hpp     scope_exit.hpp 
foreach_fwd.hpp    serialization 
foreach.hpp     shared_array.hpp 
format      shared_container_iterator.hpp 
format.hpp     shared_ptr.hpp 
function      signal.hpp 
functional     signals 
functional.hpp    signals2 
function_equal.hpp   signals2.hpp 
function.hpp     signals.hpp 
function_output_iterator.hpp smart_ptr 
function_types    smart_ptr.hpp 
fusion      sort 
generator_iterator.hpp  spirit 
geometry      spirit.hpp 
geometry.hpp     statechart 
get_pointer.hpp    static_assert.hpp 
gil       swap.hpp 
graph       system 
hana       test 
hana.hpp      thread 
heap       thread.hpp 
icl       throw_exception.hpp 
implicit_cast.hpp    timer 
indirect_reference.hpp  timer.hpp 
integer      token_functions.hpp 
integer_fwd.hpp    token_iterator.hpp 
integer.hpp     tokenizer.hpp 
integer_traits.hpp   tr1 
interprocess     tti 
intrusive      tuple 
intrusive_ptr.hpp    type_erasure 
io       type.hpp 
io_fwd.hpp     type_index 
iostreams      type_index.hpp 
is_placeholder.hpp   typeof 
iterator      type_traits 
iterator_adaptors.hpp   type_traits.hpp 
iterator.hpp     units 
lambda      unordered 
last_value.hpp    unordered_map.hpp 
lexical_cast     unordered_set.hpp 
lexical_cast.hpp    utility 
limits.hpp     utility.hpp 
locale      uuid 
locale.hpp     variant 
local_function    variant.hpp 
local_function.hpp   version.hpp 
lockfree      visit_each.hpp 
log       vmd 
logic       wave 
make_default.hpp    wave.hpp 
make_shared.hpp    weak_ptr.hpp 
make_unique.hpp    xpressive 

提升是对的archlinux回购

还有一个问题的最新分布1.64_02。 有没有一种干净的方式来包括对git CMake项目的提升依赖关系? 就像使用子模块一样? 我试过,但不能出来一个简单的干净的想法。

回答

1

手动提供-DBOOST_ROOT = “/ usr/include目录”

你提供了错误的位置。相反,你应该做

-D BOOST_LIBRARYDIR=/usr/lib/boost 

或无论你的Boost库在哪里。

+0

你能回答我的第二个问题吗?有没有一种“子模块方式”来优雅地处理增强依赖关系? –

+0

我在usr/lib/boost中没有任何内容 –

+0

你是如何安装boost的? 'sudo apt-get install libboost-all-dev'? – Nibor