50 lines
1.5 KiB
CMake
50 lines
1.5 KiB
CMake
# See the end of this file for copyright and license terms.
|
|
|
|
cmake_minimum_required(VERSION 3.14.0)
|
|
project(neo VERSION 0.1.0 LANGUAGES C)
|
|
set(CMAKE_C_STANDARD 11)
|
|
set(CMAKE_C_EXTENSIONS ON)
|
|
|
|
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
option(DEBUG "Enable debug features" ON)
|
|
endif()
|
|
|
|
find_package(Git QUIET)
|
|
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
|
|
execute_process(
|
|
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
OUTPUT_VARIABLE neo_GIT_REVISION
|
|
ERROR_QUIET
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
)
|
|
if (NOT "${neo_GIT_REVISION}" STREQUAL "")
|
|
set(neo_VERSION_SUFFIX "-${neo_GIT_REVISION}")
|
|
endif()
|
|
endif()
|
|
|
|
add_subdirectory(src)
|
|
|
|
add_subdirectory(demo)
|
|
|
|
option(BUILD_TESTING "Build tests" ON)
|
|
if((CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME OR NEO_BUILD_TESTING) AND BUILD_TESTING)
|
|
enable_testing()
|
|
add_subdirectory(test)
|
|
endif()
|
|
|
|
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
|
|
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
|
|
include(CPack)
|
|
|
|
# This file is part of libneo.
|
|
# Copyright (c) 2021 Fefie <owo@fef.moe>.
|
|
#
|
|
# libneo is non-violent software: you may only use, redistribute,
|
|
# and/or modify it under the terms of the CNPLv6+ as found in
|
|
# the LICENSE file in the source code root directory or at
|
|
# <https://git.pixie.town/thufie/CNPL>.
|
|
#
|
|
# libneo comes with ABSOLUTELY NO WARRANTY, to the extent
|
|
# permitted by applicable law. See the CNPLv6+ for details.
|