35 lines
1.2 KiB
CMake
35 lines
1.2 KiB
CMake
cmake_minimum_required(VERSION 3.16)
|
|
|
|
project(mf C CXX)
|
|
|
|
|
|
find_package(SQLite3 REQUIRED)
|
|
|
|
|
|
if (CMAKE_BUILD_TYPE MATCHES "Debug")
|
|
if (NOT FLAGS)
|
|
list(APPEND FLAGS -fsanitize=undefined)
|
|
endif()
|
|
# https://sourceforge.net/p/valgrind/mailman/valgrind-users/thread/Ygze8PzaQAYWlKDj%40wildebeest.org/
|
|
list(APPEND FLAGS -gdwarf-4)
|
|
endif()
|
|
|
|
# https://t.me/NightShadowsHangout/670691
|
|
list(APPEND FLAGS -Werror -Wall -Wextra -Wshadow -Wpedantic -Wno-gnu-anonymous-struct -fPIC -fno-rtti -Wconversion -Wno-unused-parameter -Wimplicit-fallthrough)
|
|
|
|
# i have no idea why this hack wasn't needed before but it's needed if sanitizers are used
|
|
add_link_options(${FLAGS})
|
|
|
|
|
|
add_executable(${PROJECT_NAME} main.cpp sqlite_wrapper.cpp database.cpp utils.cpp blankie/cliparse.cpp
|
|
subcommand_create.cpp subcommand_search.cpp subcommand_prune.cpp
|
|
subcommand_info.cpp subcommand_delete.cpp subcommand_edit.cpp subcommand_get.cpp subcommand_set.cpp)
|
|
set_target_properties(${PROJECT_NAME}
|
|
PROPERTIES
|
|
CXX_STANDARD 20
|
|
CXX_STANDARD_REQUIRED YES
|
|
CXX_EXTENSIONS NO
|
|
)
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE SQLite::SQLite3)
|
|
target_compile_options(${PROJECT_NAME} PRIVATE ${FLAGS})
|