-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
51 lines (41 loc) · 1.96 KB
/
CMakeLists.txt
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
cmake_minimum_required (VERSION 3.13.0 FATAL_ERROR)
project (gfxbox2 LANGUAGES C CXX)
if(${CMAKE_VERSION} VERSION_LESS "3.18.0")
message(STATUS "CMake ${CMAKE_VERSION}, please consider to switch to CMake 3.18.0 or later")
else()
message(STATUS "CMake ${CMAKE_VERSION} >= 3.18.0, good.")
endif()
set (THREADS_PREFER_PTHREAD_FLAG ON)
find_package (Threads REQUIRED)
# set(CMAKE_MESSAGE_LOG_LEVEL DEBUG)
# set(DEBUG ON)
if(NOT DEFINED DONT_USE_RTTI)
set(DONT_USE_RTTI ON)
message(STATUS "${PROJECT_NAME} DONT_USE_RTTI ${DONT_USE_RTTI} (gfxbox2 default)")
else()
message(STATUS "${PROJECT_NAME} DONT_USE_RTTI ${DONT_USE_RTTI} (user)")
endif()
include(Setup.cmake)
Setup()
# Fixup clangd w/ absolute path
set (gfxbox2_clangd_source_args "-isystem, ${CMAKE_CURRENT_SOURCE_DIR}/include, -isystem, ${CMAKE_CURRENT_SOURCE_DIR}/src, -isystem, ${CMAKE_CURRENT_SOURCE_DIR}/examples, -isystem, ${CMAKE_CURRENT_SOURCE_DIR}/examples/funcdraw")
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/clangd.in
${CMAKE_CURRENT_BINARY_DIR}/.clangd)
file(COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/.clangd ${CMAKE_CURRENT_SOURCE_DIR}/.clangd)
# this is the library version, derived from git tag and revision
set (gfxbox2_VERSION_MAJOR ${VERSION_MAJOR})
set (gfxbox2_VERSION_MINOR ${VERSION_MINOR})
set (gfxbox2_VERSION_PATCH ${VERSION_PATCH})
set (gfxbox2_VERSION_COMMITS ${VERSION_COMMITS})
set (gfxbox2_VERSION_SHA1 ${VERSION_SHA1})
set (gfxbox2_VERSION_SHA1_SHORT ${VERSION_SHA1_SHORT})
set (gfxbox2_GIT_DIRTY ${GIT_WORKDIR_DIRTY})
set (gfxbox2_VERSION_LONG ${VERSION_LONG})
set (gfxbox2_VERSION_SHORT ${VERSION_SHORT})
set (gfxbox2_VERSION_API ${VERSION_API})
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/version.cpp.in
${CMAKE_CURRENT_BINARY_DIR}/src/version.cpp)
find_path (SYSTEM_USR_DIR "stdlib.h")
include_directories (${SYSTEM_USR_DIR})
add_subdirectory (src)
add_subdirectory (examples)