70 lines
2.2 KiB
CMake
70 lines
2.2 KiB
CMake
cmake_minimum_required(VERSION 3.18)
|
|
|
|
project(ashirt VERSION 1.2.0 LANGUAGES CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
set(CMAKE_AUTORCC ON)
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
set(NOTARIZE_AS "" CACHE STRING "Attempt to Sign Package With Provided User")
|
|
if(EXISTS ${CMAKE_SOURCE_DIR}/.git)
|
|
find_package(Git)
|
|
if(GIT_FOUND)
|
|
EXECUTE_PROCESS(
|
|
COMMAND ${GIT_EXECUTABLE} describe --long --match v*
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
OUTPUT_VARIABLE GITREV
|
|
ERROR_QUIET
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
string(REGEX MATCH [0-9]+ MAJOR ${GITREV})
|
|
string(REGEX MATCH \\.[0-9]+ MINOR ${GITREV})
|
|
string(REPLACE "." "" MINOR ${MINOR})
|
|
string(REGEX MATCH [0-9]+\- PATCH ${GITREV})
|
|
string(REPLACE "-" "" PATCH ${PATCH})
|
|
string(REGEX MATCH \-[0-9]+\- TWEAK ${GITREV})
|
|
string(REPLACE "-" "" TWEAK ${TWEAK})
|
|
set(CMAKE_PROJECT_VERSION_MAJOR ${MAJOR})
|
|
set(CMAKE_PROJECT_VERSION_MINOR ${MINOR})
|
|
set(CMAKE_PROJECT_VERSION_PATCH ${PATCH})
|
|
set(CMAKE_PROJECT_VERSION_TWEAK ${TWEAK})
|
|
set(CMAKE_PROJECT_VERSION "${MAJOR}.${MINOR}.${PATCH}.${TWEAK}")
|
|
add_definitions(-DVERSION_TAG="v${MAJOR}.${MINOR}.${PATCH}")
|
|
EXECUTE_PROCESS(
|
|
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
OUTPUT_VARIABLE GITHASH
|
|
ERROR_QUIET
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
add_definitions(-DCOMMIT_HASH="${GITHASH}")
|
|
EXECUTE_PROCESS(
|
|
COMMAND ${GIT_EXECUTABLE} remote get-url origin
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
OUTPUT_VARIABLE GITORIGIN
|
|
ERROR_QUIET
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
add_definitions(-DSOURCE_CONTROL_REPO="${GITORIGIN}")
|
|
endif()
|
|
else()
|
|
add_definitions(-DCOMMIT_HASH="")
|
|
add_definitions(-DVERSION_TAG="")
|
|
add_definitions(-DSOURCE_CONTROL_REPO="")
|
|
endif()
|
|
message(STATUS "VERSION: ${CMAKE_PROJECT_VERSION}")
|
|
|
|
if(NOT QT_DEFAULT_MAJOR_VERSION)
|
|
set(QT_DEFAULT_MAJOR_VERSION 6 CACHE STRING "" FORCE)
|
|
endif()
|
|
|
|
find_package(Qt${QT_DEFAULT_MAJOR_VERSION} REQUIRED COMPONENTS
|
|
Widgets
|
|
Gui
|
|
Network
|
|
Sql
|
|
Core
|
|
)
|
|
|
|
add_subdirectory(deploy)
|
|
add_subdirectory(src)
|