0
iam试图构建boost库并使用cmake构建我的应用程序。 构建和安装升压只是跟随Getting Started Guide和更改前缀为/ usr构建和链接提升
./bootstrap.sh --prefix=/usr
./b2 install
至于结果,我现在在/ usr/lib目录下:
libboost_atomic.a
libboost_atomic.so
libboost_atomic.so.1.64.0
...
而且在/ usr/include中/升压
aligned_storage.hpp
align.hpp
...
我的CMakeLists.txt
cmake_minimum_required (VERSION 2.6)
project (NewMediaServer)
# Set the output folder where your program will be created
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/bin)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
# set the folder of the binarys
include_directories(${PROJECT_BINARY_DIR}/src)
# find all packages which we are depending on
find_package(Boost 1.64 REQUIRED)
# name the main cpp and the executable
add_executable(mediaserver src/MediaServer.cpp)
# configure compile and linking options
target_compile_options(mediaserver PUBLIC -std=c++11 -Wall)
target_link_libraries(mediaserver PUBLIC -pthread -lboost_system -lboost_log -lboost_log_setup -lboost_thread -lboost_date_time -lboost_filesystem)
当我运行使一切工作正常,但只要IAM运行二进制IAM收到以下错误....
非常感谢所有帮助!我'还是新的CMake和升压所以要温柔;提前
CMake 2.6版和全新的Boost 1.64:你认真吗?看看https://stackoverflow.com/a/42124857/2799037 – usr1234567
@ usr1234567尽管所需的版本可以设置为更合适的内容,但并不一定意味着OP使用2.6。 –
'CMAKE_BINARY_DIR'应被视为**只读**变量。永远不要设置它。为什么要使用[find_package(Boost)](https://cmake.org/cmake/help/v3.0/module/FindBoost.html),并且不要使用它定义的用于链接Boost的**变量? – Tsyvarev