我已经为此挣扎了一段时间。我使用CPM包管理器从github为我的项目拉库。我更喜欢这种方式,而不是其他链接方法。我也尝试了gh:boostorg/dynamic_bitset,但这也给了我问题。我能够让cmake为下面的cMakeList生成。
标题#include <boost/dynamic_bitset.hpp>用紫色下划线(我使用Visual Studio),“无法打开源文件'boost/dynamic_bitset. hpp'”
cmake_minimum_required( VERSION 3.5 )
find_package(Git)
include(get_cpm.cmake)
set(SFML_BUILD_EXAMPLES OFF)
set(BUILD_SHARED_LIBS OFF)
set(SFML_DIR "${SFML_SOURCE_DIR}")
set(TGUI_BACKEND "SFML_GRAPHICS")
CPMAddPackage("gh:skypjack/entt#v3.10.1")
CPMAddPackage("gh:SFML/SFML#2.6.x")
CPMAddPackage("gh:texus/[email protected]")
CPMAddPackage("gh:nlohmann/[email protected]")
CPMAddPackage("gh:boostorg/boost#boost-1.83.0")
project( Eridanus )
find_package( OpenGL REQUIRED )
include_directories( ${OPENGL_INCLUDE_DIRS} )
get_filename_component(PARENT_DIR ../ ABSOLUTE)
include_directories(
${PROJECT_SOURCE_DIR}
"${PARENT_DIR}/Eridanus4x/headers"
"${PARENT_DIR}/Eridanus4x"
"${PARENT_DIR}/Eridanus4x/SelbaWard"
)
add_executable(${CMAKE_PROJECT_NAME}
main.cpp
game.cpp
.... etc.
target_link_libraries(${PROJECT_NAME} PRIVATE sfml-graphics sfml-window sfml-system EnTT::EnTT TGUI::TGUI nlohmann_json::nlohmann_json Boost::dynamic_bitset)
option(BUILD_EXAMPLES "Build examples" OFF)
字符串
1条答案
按热度按时间xlpyo6sf1#
奇怪的是,它不会像CPM通常允许的那样工作,用下面的一行替换了用于boost的CPMAddPackage行。CPMAddPackage(NAME Boost URL“https://github.com/boostorg/boost/releases/download/boost-1.83.0/boost-1.83.0.tar.xz“)
来源:https://github.com/cpm-cmake/CPM.cmake/issues/501