add: VERSION in CMakeLists

This commit is contained in:
Tobias Reisinger 2020-06-17 01:02:53 +02:00
parent 0d52ec1338
commit 0a3323cdad

View file

@ -1,13 +1,16 @@
cmake_minimum_required (VERSION 3.7) cmake_minimum_required (VERSION 3.7)
project(core) project(core
VERSION 0.1.0
LANGUAGES c)
add_executable(core src/main.c) add_executable(core src/main.c)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wpedantic -Werror -Wall -Wextra -luuid -lsqlite3 -ffile-prefix-map=${CMAKE_SOURCE_DIR}/src/=") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wpedantic -Werror -Wall -Wextra -luuid -lsqlite3 -ffile-prefix-map=${CMAKE_SOURCE_DIR}/src/=")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -fprofile-arcs -ftest-coverage") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -fprofile-arcs -ftest-coverage")
add_definitions("-DMG_ENABLE_EXTRA_ERRORS_DESC") add_definitions("-DMG_ENABLE_EXTRA_ERRORS_DESC")
add_definitions("-DEMGAUWA_CORE_VERSION=${CMAKE_PROJECT_VERSION}")
aux_source_directory(src/ SRC_DIR) aux_source_directory(src/ SRC_DIR)
aux_source_directory(src/models MODELS_SRC) aux_source_directory(src/models MODELS_SRC)
@ -17,18 +20,20 @@ aux_source_directory(src/endpoints ENDPOINTS_SRC)
configure_file("core.ini" "core.ini" COPYONLY) configure_file("core.ini" "core.ini" COPYONLY)
add_dependencies(core migrations)
target_sources(core PRIVATE ${SRC_DIR} ${HANDLERS_SRC} ${HELPERS_SRC} ${MODELS_SRC} ${ENDPOINTS_SRC}) target_sources(core PRIVATE ${SRC_DIR} ${HANDLERS_SRC} ${HELPERS_SRC} ${MODELS_SRC} ${ENDPOINTS_SRC})
target_include_directories(core PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) target_include_directories(core PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_include_directories(core PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/vendor) target_include_directories(core PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/vendor)
add_custom_target(migrations add_custom_target(migrations
COMMAND ./compile_migrations.sh COMMAND ./compile_migrations.sh
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
) )
add_custom_target(migrations ALL
COMMAND ./compile_migrations.sh
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_custom_target(run add_custom_target(run
COMMAND ./core start COMMAND ./core start
DEPENDS core DEPENDS core