最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c++ - Could not find a package configuration file provided by "Boost" with any of [cmake] the following names:

programmeradmin3浏览0评论

I have installed boost in C:\Program Files\boost\boost_1_87_0, have different versions I've tried

  1. Follow the error (changed to both: C:\Program Files\boost\boost_1_87_0\tools\boost_install and C:\Program Files\boost\boost_1_87_0\tools\cmake\config): missies file which doesn't appear on my computer (searched by evrything)
  2. Seted BOOST_ROOT: no result
  3. Seted BOOST_DIR: no result
cmake_minimum_required (VERSION 4.0)

if (POLICY CMP0141)
  cmake_policy(SET CMP0141 NEW)
  set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
endif()

project ("OSLab2")
add_subdirectory(src/main)
set(CXX_STANDARD 98)

# set(BOOST_ROOT "C:\\Program Files\\boost\\boost_1_87_0\\tools\\boost_install")
set(Boost_DEBUG ON)

# set(Boost_DIR "C:\\Program\ Files\\boost\\boost_1_87_0")
# set(Boost_DIR "C:\\Program Files\\boost\\boost_1_87_0\\tools\\cmake\\config")
# set(Boost_DIR "C:\\Program Files\\boost\\boost_1_87_0\\tools\\boost_install")
find_package(Boost REQUIRED COMPONENTS lambda)

include_directories(${Boost_INCLUDE_DIRS})

# sets install default path to current repository
set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}")
set(BIN_PATH bin)

install(TARGETS DESTINATION ${BIN_PATH}) # P.S. install dir do not work

Output of console

[main] Configuring project: OSLab2 
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe -DCMAKE_INSTALL_PREFIX=C:/Users/Ilya/work/OS/OSLab2/bin -SC:/Users/Ilya/work/OS/OSLab2 -BC:/Users/Ilya/work/OS/OSLab2/build -G Ninja
[cmake] -- The C compiler identification is MSVC 19.43.34808.0
[cmake] -- The CXX compiler identification is MSVC 19.43.34808.0
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.43.34808/bin/Hostx64/x64/cl.exe - skipped
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.43.34808/bin/Hostx64/x64/cl.exe - skipped
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] CMake Error at CMakeLists.txt:27 (find_package):
[cmake]   By not providing "FindBoost.cmake" in CMAKE_MODULE_PATH this project has
[cmake]   asked CMake to find a package configuration file provided by "Boost", but
[cmake]   CMake did not find one.
[cmake] 
[cmake]   Could not find a package configuration file provided by "Boost" with any of
[cmake]   the following names:
[cmake] 
[cmake]     BoostConfig.cmake
[cmake]     boost-config.cmake
[cmake] 
[cmake]   Add the installation prefix of "Boost" to CMAKE_PREFIX_PATH or set
[cmake]   "Boost_DIR" to a directory containing one of the above files.  If "Boost"
[cmake]   provides a separate development package or SDK, be sure it has been
[cmake]   installed.
[cmake] 
[cmake] 
[cmake] -- Configuring incomplete, errors occurred!
[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe -DCMAKE_INSTALL_PREFIX=C:/Users/Ilya/work/OS/OSLab2/bin -SC:/Users/Ilya/work/OS/OSLab2 -BC:/Users/Ilya/work/OS/OSLab2/build -G Ninja exited with code: 1

Used vs code configuration and cmake command

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论