#Proper way to add libraries from GitHub via CMake?

5 messages · Page 1 of 1 (latest)

mellow tinsel
#
cmake_minimum_required(VERSION 3.25)
project(StockDory)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "-g -ftime-report")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -mavx512f -mavx512bw")

set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CMAKE_COMMAND} -E time")

include(FetchContent)

FetchContent_Declare(ftxui
        GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
        GIT_TAG v3.0.0
        )

FetchContent_GetProperties(ftxui)
if(NOT ftxui_POPULATED)
    FetchContent_Populate(ftxui)
    add_subdirectory(${ftxui_SOURCE_DIR} ${ftxui_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()

FetchContent_Declare(MantaRay
        GIT_REPOSITORY https://github.com/TheBlackPlague/MantaRay
        GIT_TAG master
        )

FetchContent_GetProperties(MantaRay)
if (NOT MantaRay_POPULATED)
    FetchContent_Populate(MantaRay)
    add_subdirectory(${MantaRay_SOURCE_DIR} ${MantaRay_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()

file(GLOB StockDoryBackendType
        "src/Backend/Type/*.h"
        "src/Backend/Template/*.h"
        "src/Backend/Move/*.h"
        "src/Backend/*.h")

add_executable(StockDory src/Terminal/main.cpp ${StockDoryBackendType})

target_link_libraries(StockDory ftxui::screen ftxui::dom ftxui::component MantaRay)

I'm trying to do it in the same manner as FTXUI, but it doesn't seem to work for MantaRay. It works fine for FTXUI.

Error:

CMake Error at CMakeLists.txt:32 (add_subdirectory):
  add_subdirectory given source "EXCLUDE_FROM_ALL" which is not an existing
  directory.

Any thoughts on how to?

brisk fernBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

trail pulsar
#

are either of these actually empty? ${MantaRay_SOURCE_DIR} ${MantaRay_BINARY_DIR}

#

check them with message()

mellow tinsel
#

!solved