Я использую Clion для C ++ и Cmake, а также требуется использование Conan. < /p>
Я пробовал оба с CONAN с CLI и плагином CONAN, но оба не смогут для меня, когда я пытаюсь добавить. /> Я создаю conanfile.py следующим образом: < /li>
< /ol>
Код: Выделить всё
from conan import ConanFile
from conan.tools.cmake import cmake_layout
class ExampleRecipe(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeDeps", "CMakeToolchain"
def requirements(self):
self.requires("boost/1.87.0")
def layout(self):
cmake_layout(self)
< /code>
(Важное примечание, что у меня еще нет настройки интерпретатора Python, idk, если он связан) < /p>
Я запустил следующую команду: < /li>
< /ol>
conan install . --output-folder=build --build=missing
< /code>
Это результат: < /p>
======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=194
os=Windows
Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=194
os=Windows
======== Computing dependency graph ========
Graph root
conanfile.py: D:\src\ConanBoost\conanfile.py
Requirements
boost/1.87.0#0c087f18c4e6487235dd10480613cbb5 - Cache
bzip2/1.0.8#00b4a4658791c1f06914e087f0e792f5 - Cache
zlib/1.3.1#b8bc2603263cf7eccbd6e17e66b0ed76 - Cache
Build requirements
b2/5.3.2#7b5fabfe7088ae933fb3e78302343ea0 - Cache
Resolved version ranges
b2/[>=5.2 =1.2.11 =3.23) cmake --preset conan-default
(cmake
Я обновил cmake, чтобы выглядеть так: < /li>
< /ol>
cmake_minimum_required(VERSION 3.31)
project(ConanBoost)
set(CMAKE_CXX_STANDARD 20)
message(STATUS "Boost_DIR: ${Boost_DIR}")
find_package(Boost)
add_executable(ConanBoost main.cpp)
< /code>
И я наконец -то строю, иногда это удастся иногда терпеть неудачу, но если я добавляю необходимый, то это всегда сбой со следующей ошибкой: < /p>
CMake Error at CMakeLists.txt:7 (find_package):
By not providing "FindBoost.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Boost", but
CMake did not find one.
Could not find a package configuration file provided by "Boost" with any of
the following names:
BoostConfig.cmake
boost-config.cmake
Add the installation prefix of "Boost" to CMAKE_PREFIX_PATH or set
"Boost_DIR" to a directory containing one of the above files. If "Boost"
provides a separate development package or SDK, be sure it has been
installed.
-- Configuring incomplete, errors occurred!
[Finished]
< /code>
Я новичок в C ++, Cmake и все, что я не знаю все внутренние ...
Я подумал, что из -за изменения повышения мы больше не имеем findboost.cmake сгенерированы, но Boostconfig.cmake.
Изменение cmake с find_package (BOOST требуется конфигурация) < /code> yile[0/1] Re-running CMake...
-- Configuring incomplete, errors occurred!
FAILED: build.ninja
"C:\Program Files\JetBrains\CLion 2025.1.1\bin\cmake\win\x64\bin\cmake.exe" --regenerate-during-build -SD:\src\ConanBoost -BD:\src\ConanBoost\cmake-build-debug
CMake Error at CMakeLists.txt:7 (find_package):
Could not find a package configuration file provided by "Boost" with any of
the following names:
BoostConfig.cmake
boost-config.cmake
Add the installation prefix of "Boost" to CMAKE_PREFIX_PATH or set
"Boost_DIR" to a directory containing one of the above files. If "Boost"
provides a separate development package or SDK, be sure it has been
installed.
ninja: error: rebuilding 'build.ninja': subcommand failed
>
Подробнее здесь: https://stackoverflow.com/questions/796 ... make-clion
Мобильная версия