You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
104 lines
2.5 KiB
104 lines
2.5 KiB
cmake_minimum_required(VERSION 3.14) |
|
|
|
include(cmake/prelude.cmake) |
|
|
|
project( |
|
testts |
|
VERSION 0.1.0 |
|
DESCRIPTION "Short description" |
|
HOMEPAGE_URL "https://example.com/" |
|
LANGUAGES CXX |
|
) |
|
|
|
include(cmake/project-is-top-level.cmake) |
|
include(cmake/variables.cmake) |
|
|
|
add_subdirectory(tree-sitter-cmake) |
|
|
|
set ("CONAN_DISABLE_CHECK_COMPILER") |
|
|
|
# ---- Declare library ---- |
|
|
|
add_library( |
|
testts_db OBJECT |
|
source/db.cpp |
|
) |
|
|
|
add_library( |
|
testts_lib OBJECT |
|
source/lib.cpp |
|
) |
|
|
|
|
|
target_include_directories( |
|
testts_db ${warning_guard} |
|
PUBLIC |
|
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/source>" |
|
) |
|
|
|
target_include_directories( |
|
testts_lib ${warning_guard} |
|
PUBLIC |
|
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/source>" |
|
) |
|
|
|
target_compile_features(testts_db PUBLIC cxx_std_20) |
|
target_compile_features(testts_lib PUBLIC cxx_std_20) |
|
|
|
|
|
find_package(cxxopts REQUIRED) |
|
find_package(SQLiteCpp REQUIRED) |
|
|
|
find_package(fmt REQUIRED) |
|
find_package(tree-sitter REQUIRED) |
|
|
|
find_package(Tree-Sitter CONFIG) |
|
find_package(Tree-Sitter CONFIG REQUIRED C) |
|
|
|
target_link_libraries(testts_db PRIVATE fmt::fmt) |
|
target_link_libraries(testts_db PRIVATE Tree-Sitter::Tree-Sitter Tree-Sitter::Tree-Sitter-C tree-sitter::tree-sitter) |
|
target_link_libraries(testts_db PRIVATE SQLiteCpp) |
|
|
|
|
|
target_link_libraries(testts_lib PRIVATE fmt::fmt) |
|
target_link_libraries(testts_lib PRIVATE Tree-Sitter::Tree-Sitter Tree-Sitter::Tree-Sitter-C tree-sitter::tree-sitter) |
|
|
|
# ---- Declare executable ---- |
|
|
|
add_executable(testts_exe source/main.cpp) |
|
add_executable(testts::exe ALIAS testts_exe) |
|
|
|
set_property(TARGET testts_exe PROPERTY OUTPUT_NAME testts) |
|
|
|
target_compile_features(testts_exe PRIVATE cxx_std_20) |
|
|
|
target_link_libraries(testts_exe PRIVATE testts_lib) |
|
target_link_libraries(testts_exe PRIVATE testts_db) |
|
target_link_libraries(testts_exe PRIVATE Tree-Sitter::Tree-Sitter Tree-Sitter::Tree-Sitter-C tree-sitter::tree-sitter) |
|
target_link_libraries(testts_exe PRIVATE fmt::fmt) |
|
target_link_libraries(testts_exe PRIVATE cxxopts::cxxopts) |
|
|
|
# ---- Install rules ---- |
|
|
|
if(NOT CMAKE_SKIP_INSTALL_RULES) |
|
include(cmake/install-rules.cmake) |
|
endif() |
|
|
|
# ---- Developer mode ---- |
|
|
|
if(NOT testts_DEVELOPER_MODE) |
|
return() |
|
elseif(NOT PROJECT_IS_TOP_LEVEL) |
|
message( |
|
AUTHOR_WARNING |
|
"Developer mode is intended for developers of testts" |
|
) |
|
endif() |
|
|
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") |
|
add_compile_options(-fdiagnostics-color=always) |
|
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") |
|
add_compile_options(-fcolor-diagnostics) |
|
endif() |
|
|
|
include(cmake/dev-mode.cmake)
|
|
|