mirror of
https://github.com/falcosecurity/falco.git
synced 2025-07-18 16:51:30 +00:00
build: force falco version to always start with a digit
Falco version respects the following rules: If the current commit matches (exactly) a git tag then the FALCO_VERSION equals it (with the initial "v" stripped out). Otherwise FALCO_VERSION is 0.<commit hash>[.-dirty]. Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
This commit is contained in:
parent
7b2b0b14a5
commit
e598606505
@ -19,6 +19,14 @@ cmake_minimum_required(VERSION 2.8.2)
|
|||||||
|
|
||||||
project(falco)
|
project(falco)
|
||||||
|
|
||||||
|
if(NOT SYSDIG_DIR)
|
||||||
|
get_filename_component(SYSDIG_DIR "${PROJECT_SOURCE_DIR}/../sysdig" REALPATH)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Custom CMake modules
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${SYSDIG_DIR}/cmake/modules")
|
||||||
|
|
||||||
option(BUILD_WARNINGS_AS_ERRORS "Enable building with -Wextra -Werror flags")
|
option(BUILD_WARNINGS_AS_ERRORS "Enable building with -Wextra -Werror flags")
|
||||||
|
|
||||||
if(NOT DEFINED FALCO_ETC_DIR)
|
if(NOT DEFINED FALCO_ETC_DIR)
|
||||||
@ -59,28 +67,6 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|||||||
add_definitions(-DHAS_CAPTURE)
|
add_definitions(-DHAS_CAPTURE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(PACKAGE_NAME "falco")
|
|
||||||
set(PROBE_VERSION "${FALCO_VERSION}")
|
|
||||||
set(PROBE_NAME "falco-probe")
|
|
||||||
set(PROBE_DEVICE_NAME "falco")
|
|
||||||
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
|
||||||
set(CMAKE_INSTALL_PREFIX /usr CACHE PATH "Default install path" FORCE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMD_MAKE make)
|
|
||||||
|
|
||||||
if(NOT SYSDIG_DIR)
|
|
||||||
get_filename_component(SYSDIG_DIR "${PROJECT_SOURCE_DIR}/../sysdig" REALPATH)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Add path for custom CMake modules
|
|
||||||
list(APPEND CMAKE_MODULE_PATH
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
|
|
||||||
|
|
||||||
# Add path for custom CMake modules used to build dependencies from Sysdig (libscap, libsinsp)
|
|
||||||
list(APPEND CMAKE_MODULE_PATH
|
|
||||||
"${SYSDIG_DIR}/cmake/modules")
|
|
||||||
|
|
||||||
# Create the falco version variable according to git index
|
# Create the falco version variable according to git index
|
||||||
if(NOT FALCO_VERSION)
|
if(NOT FALCO_VERSION)
|
||||||
include(GetGitRevisionDescription)
|
include(GetGitRevisionDescription)
|
||||||
@ -90,12 +76,29 @@ if(NOT FALCO_VERSION)
|
|||||||
git_local_changes(FALCO_CHANGES)
|
git_local_changes(FALCO_CHANGES)
|
||||||
if(FALCO_CHANGES STREQUAL "DIRTY")
|
if(FALCO_CHANGES STREQUAL "DIRTY")
|
||||||
string(TOLOWER "${FALCO_CHANGES}" FALCO_CHANGES)
|
string(TOLOWER "${FALCO_CHANGES}" FALCO_CHANGES)
|
||||||
set(FALCO_VERSION "${FALCO_VERSION}-${FALCO_CHANGES}")
|
set(FALCO_VERSION "${FALCO_VERSION}.${FALCO_CHANGES}")
|
||||||
endif()
|
endif()
|
||||||
|
set(FALCO_VERSION "0.${FALCO_VERSION}")
|
||||||
else()
|
else()
|
||||||
set(FALCO_VERSION "${FALCO_TAG}")
|
set(FALCO_VERSION "${FALCO_TAG}")
|
||||||
|
string(REGEX
|
||||||
|
REPLACE "^v([0-9]+)(\\.[0-9]+)(\\.[0-9]+)?"
|
||||||
|
"\\1\\2\\3"
|
||||||
|
FALCO_VERSION
|
||||||
|
${FALCO_VERSION})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
message(STATUS "Falco version is ${FALCO_VERSION}")
|
||||||
|
|
||||||
|
set(PACKAGE_NAME "falco")
|
||||||
|
set(PROBE_VERSION "${FALCO_VERSION}")
|
||||||
|
set(PROBE_NAME "falco-probe")
|
||||||
|
set(PROBE_DEVICE_NAME "falco")
|
||||||
|
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||||
|
set(CMAKE_INSTALL_PREFIX /usr CACHE PATH "Default install path" FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CMD_MAKE make)
|
||||||
|
|
||||||
# make luaJIT work on OS X
|
# make luaJIT work on OS X
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
|
Loading…
Reference in New Issue
Block a user