本文介绍了找不到boost_process cmake find_package的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图将Boost库导入到我的C ++项目中,由于某种原因,它找不到Boost.Process,尽管它找到了其他库.

I'm trying to import boost libraries into my C++ project, and for some reason it cannot find Boost.Process, although it finds the others.

我的CMakeLists.txt文件:

My CMakeLists.txt file:

cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
set (PROJECT_NAME "test-stuff" CXX)
project (${PROJECT_NAME})

set(Boost_USE_MULTITHREADED ON)

find_package(Boost 1.64.0 REQUIRED system filesystem process)

if(Boost_FOUND)
  include_directories (SYSTEM ${Boost_INCLUDE_DIR})
endif()

include_directories(include)

file(GLOB SOURCES "src/*.cpp")

add_executable(${PROJECT_NAME} ${SOURCES})

target_link_libraries (${PROJECT_NAME} ${Boost_LIBRARIES})

错误的完整跟踪信息(带有调试设置):

The full trace of the error (with debug setting):

The CXX compiler identification is AppleClang 8.1.0.8020042
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1039 ] _boost_TEST_VERSIONS = 1.64.0;1.64
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1041 ] Boost_USE_MULTITHREADED = ON
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1043 ] Boost_USE_STATIC_LIBS =
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1045 ] Boost_USE_STATIC_RUNTIME =
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1047 ] Boost_ADDITIONAL_VERSIONS =
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1049 ] Boost_NO_SYSTEM_PATHS =
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1117 ] Declared as CMake or Environmental Variables:
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1119 ]   BOOST_ROOT =
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1121 ]   BOOST_INCLUDEDIR =
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1123 ]   BOOST_LIBRARYDIR =
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1125 ] _boost_TEST_VERSIONS = 1.64.0;1.64
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1200 ] Include debugging info:
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1202 ]   _boost_INCLUDE_SEARCH_DIRS = PATHS;C:/boost/include;C:/boost;/sw/local/include
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1204 ]   _boost_PATH_SUFFIXES = boost-1_64_0;boost_1_64_0;boost/boost-1_64_0;boost/boost_1_64_0;boost-1_64;boost_1_64;boost/boost-1_64;boost/boost_1_64
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1224 ] location of version.hpp: /usr/local/include/boost/version.hpp
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1248 ] version.hpp reveals boost 1.64.0
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1334 ] guessed _boost_COMPILER =
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1344 ] _boost_MULTITHREADED = -mt
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1388 ] _boost_RELEASE_ABI_TAG = -
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1390 ] _boost_DEBUG_ABI_TAG = -d
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1452 ] _boost_LIBRARY_SEARCH_DIRS_RELEASE = /usr/local/include/lib;/usr/local/include/../lib;/usr/local/include/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib_boost_LIBRARY_SEARCH_DIRS_DEBUG   = /usr/local/include/lib;/usr/local/include/../lib;/usr/local/include/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1597 ] Searching for SYSTEM_LIBRARY_RELEASE: boost_system-mt-1_64;boost_system-mt;boost_system
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:371 ]  Boost_LIBRARY_DIR_RELEASE = /usr/local/lib _boost_LIBRARY_SEARCH_DIRS_RELEASE = /usr/local/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1646 ] Searching for SYSTEM_LIBRARY_DEBUG: boost_system-mt-d-1_64;boost_system-mt-d;boost_system-mt;boost_system
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:371 ]  Boost_LIBRARY_DIR_DEBUG = /usr/local/lib _boost_LIBRARY_SEARCH_DIRS_DEBUG = /usr/local/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1597 ] Searching for FILESYSTEM_LIBRARY_RELEASE: boost_filesystem-mt-1_64;boost_filesystem-mt;boost_filesystem
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:371 ]  Boost_LIBRARY_DIR_RELEASE = /usr/local/lib _boost_LIBRARY_SEARCH_DIRS_RELEASE = /usr/local/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1646 ] Searching for FILESYSTEM_LIBRARY_DEBUG: boost_filesystem-mt-d-1_64;boost_filesystem-mt-d;boost_filesystem-mt;boost_filesystem
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:371 ]  Boost_LIBRARY_DIR_DEBUG = /usr/local/lib _boost_LIBRARY_SEARCH_DIRS_DEBUG = /usr/local/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
CMake Warning at /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1566 (message):
  No header defined for process; skipping header check
Call Stack (most recent call first):
  CMakeLists.txt:19 (find_package)


-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1597 ] Searching for PROCESS_LIBRARY_RELEASE: boost_process-mt-1_64;boost_process-mt;boost_process
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:371 ]  Boost_LIBRARY_DIR_RELEASE = /usr/local/lib _boost_LIBRARY_SEARCH_DIRS_RELEASE = /usr/local/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1646 ] Searching for PROCESS_LIBRARY_DEBUG: boost_process-mt-d-1_64;boost_process-mt-d;boost_process-mt;boost_process
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:371 ]  Boost_LIBRARY_DIR_DEBUG = /usr/local/lib _boost_LIBRARY_SEARCH_DIRS_DEBUG = /usr/local/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1719 ] Boost_FOUND = 1
CMake Error at /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindBoost.cmake:1879 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.64.0

  Boost include path: /usr/local/include

  Could not find the following Boost libraries:

          boost_process

  Some (but not all) of the required Boost libraries were found.  You may
  need to install these additional Boost libraries.  Alternatively, set
  BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
  to the location of Boost.
Call Stack (most recent call first):
  CMakeLists.txt:19 (find_package)

我知道Boost.Process仅包含在Boost 1.64及更高版本中,但是根据输出,我使用的是Boost 1.64和Cmake 3.9.我查看了/usr/local/include/boost并找到了process.hpp.

I know Boost.Process was only included in Boost 1.64 and up, but according to the output I'm using Boost 1.64, and Cmake 3.9. I looked in /usr/local/include/boost and process.hpp was there.

谢谢您的建议.

推荐答案

因此,经过数小时的反复敲击,我意识到我不需要使用find_package导入Boost.Process,因为它是一个仅标头的库(argggg).我删除了CMakeList.txt和ta-dah中的进程"导入:它起作用了.

So, after hours of banging my head against the wall, I realized I didn't need to import Boost.Process with find_package since it's a header-only library (argggg). I removed the "process" import in CMakeList.txt and ta-dah: it worked.

这篇关于找不到boost_process cmake find_package的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 12:15