Run cmake-init and setup flake.nix and default.nix

This commit is contained in:
2023-08-15 15:58:43 +03:00
parent 40684d900b
commit 5745001064
35 changed files with 1562 additions and 1 deletions

59
CMakeLists.txt Normal file
View File

@@ -0,0 +1,59 @@
cmake_minimum_required(VERSION 3.14)
include(cmake/prelude.cmake)
project(
ec-controller
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)
# ---- Declare library ----
add_library(
ec-controller_lib OBJECT
source/lib.cpp
)
target_include_directories(
ec-controller_lib ${warning_guard}
PUBLIC
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/source>"
)
target_compile_features(ec-controller_lib PUBLIC cxx_std_20)
# ---- Declare executable ----
add_executable(ec-controller_exe source/main.cpp)
add_executable(ec-controller::exe ALIAS ec-controller_exe)
set_property(TARGET ec-controller_exe PROPERTY OUTPUT_NAME ec-controller)
target_compile_features(ec-controller_exe PRIVATE cxx_std_20)
target_link_libraries(ec-controller_exe PRIVATE ec-controller_lib)
# ---- Install rules ----
if(NOT CMAKE_SKIP_INSTALL_RULES)
include(cmake/install-rules.cmake)
endif()
# ---- Developer mode ----
if(NOT ec-controller_DEVELOPER_MODE)
return()
elseif(NOT PROJECT_IS_TOP_LEVEL)
message(
AUTHOR_WARNING
"Developer mode is intended for developers of ec-controller"
)
endif()
include(cmake/dev-mode.cmake)