1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-23 00:15:58 +01:00

cmake: get version from meson

This commit is contained in:
Vitalii Shylienkov
2020-04-13 13:08:18 +02:00
parent 2a2a4d19c5
commit b397a72e89

View File

@@ -10,8 +10,18 @@
################################################################################### ###################################################################################
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.12)
# Read root meson.build file and get project version from it
set(ROOT_MESON_BUILD_FILE "meson.build")
file(READ "${ROOT_MESON_BUILD_FILE}" ROOT_MESON_BUILD_CONTENT)
string(REGEX MATCH " *version: '[.0-9]+'" UNITY_VERSION "${ROOT_MESON_BUILD_CONTENT}")
if(NOT UNITY_VERSION)
message(FATAL_ERROR "Cannot define version from meson build file")
endif()
string(REGEX REPLACE " *version: '([.0-9]+)'" "\\1" UNITY_VERSION "${UNITY_VERSION}")
project(unity project(unity
VERSION 2.5.0 VERSION ${UNITY_VERSION}
LANGUAGES C LANGUAGES C
DESCRIPTION "C Unit testing framework." DESCRIPTION "C Unit testing framework."
) )
@@ -58,32 +68,32 @@ set_target_properties(${PROJECT_NAME}
target_compile_options(${PROJECT_NAME} target_compile_options(${PROJECT_NAME}
PRIVATE PRIVATE
$<$<C_COMPILER_ID:Clang>:-Wcast-align> $<$<C_COMPILER_ID:Clang>:-Wcast-align
$<$<C_COMPILER_ID:Clang>:-Wcast-qual> -Wcast-qual
$<$<C_COMPILER_ID:Clang>:-Wconversion> -Wconversion
$<$<C_COMPILER_ID:Clang>:-Wexit-time-destructors> -Wexit-time-destructors
$<$<C_COMPILER_ID:Clang>:-Wglobal-constructors> -Wglobal-constructors
$<$<C_COMPILER_ID:Clang>:-Wmissing-noreturn> -Wmissing-noreturn
$<$<C_COMPILER_ID:Clang>:-Wmissing-prototypes> -Wmissing-prototypes
$<$<C_COMPILER_ID:Clang>:-Wno-missing-braces> -Wno-missing-braces
$<$<C_COMPILER_ID:Clang>:-Wold-style-cast> -Wold-style-cast
$<$<C_COMPILER_ID:Clang>:-Wshadow> -Wshadow
$<$<C_COMPILER_ID:Clang>:-Wweak-vtables> -Wweak-vtables>
$<$<C_COMPILER_ID:GNU>:-Waddress> $<$<C_COMPILER_ID:GNU>:-Waddress
$<$<C_COMPILER_ID:GNU>:-Waggregate-return> -Waggregate-return
$<$<C_COMPILER_ID:GNU>:-Wformat-nonliteral> -Wformat-nonliteral
$<$<C_COMPILER_ID:GNU>:-Wformat-security> -Wformat-security
$<$<C_COMPILER_ID:GNU>:-Wformat> -Wformat
$<$<C_COMPILER_ID:GNU>:-Winit-self> -Winit-self
$<$<C_COMPILER_ID:GNU>:-Wmissing-declarations> -Wmissing-declarations
$<$<C_COMPILER_ID:GNU>:-Wmissing-include-dirs> -Wmissing-include-dirs
$<$<C_COMPILER_ID:GNU>:-Wno-multichar> -Wno-multichar
$<$<C_COMPILER_ID:GNU>:-Wno-parentheses> -Wno-parentheses
$<$<C_COMPILER_ID:GNU>:-Wno-type-limits> -Wno-type-limits
$<$<C_COMPILER_ID:GNU>:-Wno-unused-parameter> -Wno-unused-parameter
$<$<C_COMPILER_ID:GNU>:-Wunreachable-code> -Wunreachable-code
$<$<C_COMPILER_ID:GNU>:-Wwrite-strings> -Wwrite-strings
-Wpointer-arith -Wpointer-arith>
-Wall -Wall
-Werror -Werror
) )