CMake - Attachment.h: 没有那个文件或目录

CMake - Attachment.h: No such file or directory

./dir/
├── bot_example
│   ├── CMakeLists.txt
│   └── example0.cpp
├── CMakeLists.txt
├── README.md
└── sleepy_discord
    ├── attachment.cpp
    ├── attachment.h
    ├── channel.cpp
    ├── etc...

我正在将一个纯粹 visual studio 的项目重构到 CMake 中,以使其跨平台。我在 CMake 方面没有丰富的经验,但是这个结构在一个测试项目中工作到调试问题结束。它无法包含第一个头文件(attachment.h,我似乎无法让它识别它。我已经搜索了具有相同问题的其他答案,但无济于事。感谢所有帮助.

编辑:我应该提到这在 windows 下有效,这就是为什么我感到困惑并联系 Stack Exchange 的原因。

顶级CMakeLists.txt

# Project Initialization
CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
Project("Sleepy-Discord")

# Component Initialization
add_subdirectory(sleepy_discord)
add_subdirectory(bot_example)

./sleepy_discord/CMakeLists.txt

# Initialize API 
cmake_minimum_required(VERSION 3.5)

set(Boost_USE_STATIC_LIBS     ON)
set(Boost_USE_MULTITHREADED   ON)
set(Boost_USE_STATIC_RUNTIME  OFF)
SET(BOOST_MIN_VERSION "1.58.0")
FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} REQUIRED)

FIND_PACKAGE(CURL)

SET (sleepy_discord_SOURCES
    ./attachment.cpp
    ./attachment.h

    ./channel.cpp
    ./channel.h 

    ./client.cpp 
    ./client.h 

    ./common.cpp 
    ./common.h 

    ./default_functions.cpp 

    ./discord_object_interface.cpp 
    ./discord_object_interface.h 

    ./embed.cpp 
    ./embed.h 

    ./error.h 

    ./experimental.cpp 
    ./experimental.h 

    ./json.c 
    ./json.h 

    ./json_wrapper.cpp 

    ./message.cpp 
    ./message.h 

    ./sd_error.cpp 

    ./server.cpp 
    ./server.h 

    ./sleepy_discord.h 

    ./user.cpp 
    ./user.h 
)

if(Boost_FOUND)
add_library(sleepy_discord ${sleepy_discord_SOURCES})
target_include_directories(sleepy_discord INTERFACE
  "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
  "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
  "$<BUILD_INTERFACE:${Boost_INCLUDE_DIRS}>"
  "$<BUILD_INTERFACE:${CURL_INCLUDE_DIR}>"
  "$<BUILD_INTERFACE:>${OPENSSL_INCLUDE_DIR}"
  "$<BUILD_INTERFACE:>${CPR_INCLUDE_DIR}"
)
else()
  message(STATUS "Boost library not found.")
endif()

./bot_example/CMakeLists.txt

# Initialize Bot
cmake_minimum_required(VERSION 3.5)

set(bot_example_SOURCES
    ${CMAKE_CURRENT_SOURCE_DIR}/example0.cpp
)

add_executable(bot_example ${bot_example_SOURCES})
target_link_libraries(bot_example sleepy_discord)

终端输出:

Scanning dependencies of target sleepy_discord
[  5%] Building CXX object sleepy_discord/CMakeFiles/sleepy_discord.dir/attachment.cpp.o
/home/bleugamer/Development/bots/sleepy_discord/sleepy_discord/attachment.cpp:1:24: fatal error: Attachment.h: No such file or directory
compilation terminated.
sleepy_discord/CMakeFiles/sleepy_discord.dir/build.make:62: recipe for target 'sleepy_discord/CMakeFiles/sleepy_discord.dir/attachment.cpp.o' failed
make[2]: *** [sleepy_discord/CMakeFiles/sleepy_discord.dir/attachment.cpp.o] Error 1
CMakeFiles/Makefile2:85: recipe for target 'sleepy_discord/CMakeFiles/sleepy_discord.dir/all' failed
make[1]: *** [sleepy_discord/CMakeFiles/sleepy_discord.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

在类 Unix 系统上(确切地说,在 EXT、UFS 和其他 "Unixy" 文件系统上)文件访问区分大小写。变化

#include "Attachment.h"

#include "attachment.h"