๐Ÿ“ฆ RobLoach / nuklear_console

๐Ÿ“„ CMakeLists.txt ยท 53 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53cmake_minimum_required(VERSION 3.11)
project(nuklear_console
    DESCRIPTION "nuklear_console: Console-like interface for Nuklear GUI"
    HOMEPAGE_URL "https://github.com/robloach/nuklear_console"
    VERSION 0.1.0
    LANGUAGES C
)

# nuklear_gamepad
find_package(nuklear_gamepad QUIET)
if (NOT nuklear_gamepad_FOUND)
    include(FetchContent)
    FetchContent_Declare(
        nuklear_gamepad
        GIT_REPOSITORY https://github.com/RobLoach/nuklear_gamepad.git
        GIT_TAG 49c1cba
    )
    FetchContent_GetProperties(nuklear_gamepad)
    if (NOT nuklear_gamepad_POPULATED)
        set(FETCHCONTENT_QUIET NO)
        FetchContent_Populate(nuklear_gamepad)
        add_subdirectory(${nuklear_gamepad_SOURCE_DIR} ${nuklear_gamepad_BINARY_DIR})
    endif()
endif()

# nuklear_console
add_library(nuklear_console INTERFACE)
target_include_directories(nuklear_console INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(nuklear_console INTERFACE nuklear_gamepad)

# Options
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
    set(NUKLEAR_CONSOLE_IS_MAIN TRUE)
else()
    set(NUKLEAR_CONSOLE_IS_MAIN FALSE)
endif()

option(NUKLEAR_CONSOLE_BUILD_TESTS "Tests" ${NUKLEAR_CONSOLE_IS_MAIN})

# Examples
if (NUKLEAR_CONSOLE_BUILD_TESTS)
    include(CTest)
    enable_testing()
    if (BUILD_TESTING)
        # set(CTEST_CUSTOM_TESTS_IGNORE
        #     pkg-config--static
        # )
        # Always print verbose output when tests fail if run using `make test`.
        list(APPEND CMAKE_CTEST_ARGUMENTS "--output-on-failure")
        add_subdirectory(test)
    endif()
endif()