51 lines
979 B
CMake
51 lines
979 B
CMake
cmake_minimum_required(VERSION 3.11) # FetchContent
|
|
|
|
project(keycode)
|
|
|
|
include(FetchContent)
|
|
include("cmake/Check-from_chars.cmake")
|
|
|
|
set (LIBS fmt)
|
|
|
|
if (NOT DEFINED OPTCON_LOCAL_BUILD)
|
|
FetchContent_Declare(
|
|
fmt
|
|
GIT_REPOSITORY https://github.com/fmtlib/fmt
|
|
GIT_TAG 123913715afeb8a437e6388b4473fcc4753e1c9a # 11.1.4
|
|
)
|
|
|
|
FetchContent_MakeAvailable(fmt)
|
|
endif()
|
|
|
|
if (NOT FROM_CHARS_WORKS)
|
|
FetchContent_Declare(
|
|
fast_float
|
|
GIT_REPOSITORY https://github.com/fastfloat/fast_float
|
|
GIT_TAG 77cc847c842c49e7e3477c1e95da2b6540166d66 # 8.0.0
|
|
)
|
|
|
|
FetchContent_MakeAvailable(fast_float)
|
|
|
|
list(APPEND LIBS fast_float)
|
|
add_definitions(-DUSE_FAST_FLOAT)
|
|
endif()
|
|
|
|
add_library(keycode STATIC
|
|
src/array.cpp
|
|
src/keycode.c
|
|
)
|
|
|
|
target_link_libraries(keycode ${LIBS})
|
|
|
|
target_include_directories(keycode
|
|
PUBLIC src
|
|
)
|
|
|
|
add_executable(keycode_test
|
|
src/test.c
|
|
)
|
|
|
|
target_link_libraries(keycode_test
|
|
keycode
|
|
)
|