Мой корневой файл CMakeLists.txt выглядит так:
Код: Выделить всё
cmake_minimum_required(VERSION 3.24)
project(MyProj
LANGUAGES CXX
VERSION 0.0.1)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake")
set(SDK_DIR "${CMAKE_CURRENT_SOURCE_DIR}/SDKs")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
add_subdirectory(SDKs)
add_subdirectory(Core)
Код: Выделить всё
include (FetchContent)
FetchContent_Declare(FastDelegate
GIT_REPOSITORY https://github.com/dreamcat4/FastDelegate.git
GIT_PROGRESS true
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/FastDelegate"
BINARY_DIR "${CMAKE_BINARY_DIR}/SDKs/FastDelegate"
FIND_PACKAGE_ARGS)
FetchContent_MakeAvailable(FastDelegate)
Код: Выделить всё
cmake_minimum_required(VERSION 3.24)
set(SRC_DIR "${SDK_DIR}/FastDelegate")
add_library(FastDelegate INTERFACE
"${SRC_DIR}/FastDelegate.h"
"${SRC_DIR}/FastDelegateBind.h")
add_library(SDK::FastDelegate ALIAS FastDelegate)
target_include_directories(FastDelegate INTERFACE ${SRC_DIR})
set_target_properties(FastDelegate PROPERTIES FOLDER "SDKs/FastDelegate")
Код: Выделить всё
cmake_minimum_required(VERSION 3.24)
add_library(Core STATIC
Core_defines.h)
set_target_properties(Core PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(Core
PUBLIC
SDK::FastDelegate)
# added this to make sure include directories are correct
file(GENERATE OUTPUT "$output.txt"
CONTENT "$")
Код: Выделить всё
C:/Projects/MyProj/Core;C:/Projects/MyProj/SDKs/FastDelegate
Я что-то пропустил или сделал что-то не так, или это есть проблемы с CMake?
Подробнее здесь: https://stackoverflow.com/questions/792 ... eyre-not-a