forked from fossology/fossology
-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
52 lines (44 loc) · 2 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#[=======================================================================[
SPDX-License-Identifier: GPL-2.0-only
SPDX-FileCopyrightText: © 2021 Avinal Kumar <[email protected]>
#]=======================================================================]
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
project(FOSSOLOGY)
# set defaults for the project
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/SetDefaults.cmake)
# Check latest version info from git
message(STATUS "Current fossology version ${FO_VERSION}")
message(STATUS "Latest commit hash: ${FO_COMMIT_HASH}")
message(STATUS "Current Branch: ${FO_BRANCH}")
message(STATUS "Current Build Date: ${FO_BUILD_DATE}")
message(STATUS "Latest Commit Date: ${FO_COMMIT_DATE}")
if(TESTING)
enable_testing()
endif()
# add source directories
add_subdirectory(src)
add_subdirectory(install)
# add packaging configurations
if(${CMAKE_VERSION} VERSION_LESS "3.19.0")
message(AUTHOR_WARNING "Needs CMake version greater than 3.19.0 for packaging FOSSology. Skipping ...")
else()
message(STATUS "Found CMake ${CMAKE_VERSION}. Adding FOSSology packaging configs ...")
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/FoPackaging.cmake)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/pack)
configure_file("${FO_DEBDIR}/changelog" "${CMAKE_BINARY_DIR}/pack/changelog.Debian"
COPYONLY NO_SOURCE_PERMISSIONS)
add_custom_target(changelog ALL
COMMENT "Generating changelog for packages..."
COMMAND ${CMAKE_COMMAND} -E tar czf changelog.Debian.gz changelog.Debian
COMMAND ${CMAKE_COMMAND} -E tar czf README.md.gz "${CMAKE_CURRENT_SOURCE_DIR}/README.md"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/pack)
endif()
# uninstall target
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()