编辑: https://github.com/jasin/bytecoin-gui您可以在此处看到整个项目
我已将问题追溯到位于
中的 CXX.includecache 文件{build_dir}/{sub_project}/src/CMakesFiles/CryptoNoteCore.dir/CXX.includecache
由CMake创建。它包含这一行
rocksdb/db.h
{build_dir}/{sub_project}/src/CryptoNoteCore/rocksdb/db.h
以上位置错误应该是
rocksdb/db.h
{build_dir}/{sub_project}/external/rocksdb/include/rocksdb/db.h
现在,我已将我的CMakelists目录结构设置为
source_dir
--sub_project
|--source
|--CryptoNoteCore
|--external
|--rocksdb
--project_source
这是我的 CMakeLists.txt ,我添加了 sub_directory ,因此我可以为目标依赖项生成所需的构建文件。
add_subdirectory({sub_project})
include_directories(${CMAKE_SOURCE_DIR}/${CRYPTONOTE_LIB}/external/rocksdb/include)
add_executable(${PROJECT_NAME} ${BUILD_PLATFORM} ${SOURCES})
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_DEFINITIONS _GNU_SOURCE )
target_include_directories(${PROJECT_NAME} PUBLIC
include
src
${CRYPTONOTE_LIB}/external/rocksdb/include
${CRYPTONOTE_LIB}/external
${CRYPTONOTE_LIB}/include
${CRYPTONOTE_LIB}/src/Platform/${PLATFORM_DIR}
${CRYPTONOTE_LIB}/src
)
target_link_libraries(${PROJECT_NAME}
${Boost_LIBRARIES}
${QTMAIN}
${Qt5DBus_LIBRARIES}
BlockchainExplorer
Common
Crypto
CryptoNoteCore
Http
InProcessNode
Logging
NodeRpcProxy
P2p
Rpc
Serialization
System
Transfers
Wallet
rocksdblib
Qt5::Widgets
Qt5::Gui
Qt5::Network)
在sub_project CMakelists.txt 中有这一行
include_directories(${CMAKE_SOURCE_DIR}/external/rocksdb/include)
应该告诉 CryptoNoteCore 在哪里找到 rocksdb / db.h 但如上面所述,选择中的 CXX.includecache 文件错误的位置。为什么??? 正如您所看到的,我尝试在 target_include_directories 和 include_directories 中添加正确的include目录,希望CMake能够看到它,但是这里有一些邪恶的东西,我可以& #39;弄清楚。任何帮助将不胜感激。
更新: {build_dir}/{sub_project}/src/CMakesFiles/CryptoNoteCore.dir/DependInfo.cmake
包含正确的包含路径。
# The include file search paths:
set(CMAKE_CXX_TARGET_INCLUDE_PATH
"bytecoin/src"
"D:/bytecoin-gui/bytecoin/src"
"D:/boost_1_65_1"
"D:/bytecoin-gui/bytecoin/include"
"D:/bytecoin-gui/bytecoin/external"
"bytecoin/version"
"D:/bytecoin-gui/bytecoin/src/Platform/Windows"
"D:/bytecoin-gui/bytecoin/src/platform/msc"
"D:/bytecoin-gui/external/rocksdb/include"
)