File: CMakeLists.txt

package info (click to toggle)
cmake-fedora 2.7.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid
  • size: 764 kB
  • sloc: sh: 1,336; perl: 87; makefile: 12
file content (182 lines) | stat: -rw-r--r-- 5,686 bytes parent folder | download | duplicates (2)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
cmake_minimum_required(VERSION 2.6.2)

# Included scripts do automatic cmake_policy PUSH and POP.
# OLD: CMake policy in included script will affect the invoker.
# CMAKE_POLICY(SET CMP0011 OLD)

LIST(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/Modules)
INCLUDE(ManageEnvironmentCommon RESULT_VARIABLE MANAGE_ENVIRONMENT_PATH)
GET_FILENAME_COMPONENT(CMAKE_FEDORA_MODULE_DIR 
    "${MANAGE_ENVIRONMENT_PATH}" PATH CACHE
    )

# Whether to build on fedora
SET(CMAKE_FEDORA_ENABLE_FEDORA_BUILD "1" CACHE STRING "Enable fedora build" FORCE)

####################################################################
# Project specific information
#
PROJECT(cmake-fedora NONE)
SET(PRJ_SUMMARY "CMake helper modules for fedora developers")

SET(PRJ_DESCRIPTION
"cmake-fedora consist a set of cmake modules that provides
helper macros and targets for fedora developers."
    )
SET(AUTHORS "Ding-Yi Chen")
SET(MAINTAINER "Ding-Yi Chen <dchen at redhat.com>")
SET(VENDOR "Red Hat, APAC, Inc.")
SET(LICENSE BSD)
SET(PRJ_GROUP "System Environment/Libraries")
SET(BUILD_ARCH "noarch")
SET(RPM_SPEC_URL "https://fedorahosted.org/%{name}/")
SET(RPM_SPEC_SOURCES "https://fedorahosted.org/releases/c/m/%{name}/%{name}-%{version}-Source.tar.gz")

####################################################################
# Includes
#
INCLUDE(ManageEnvironment)
INCLUDE(ManageArchive)
INCLUDE(ManageVersion)
RELEASE_NOTES_READ_FILE()
INCLUDE(ManageDependency)
INCLUDE(ManageFile)
INCLUDE(ManageSourceVersionControl)
INCLUDE(ManageTarget)
INCLUDE(ManageUninstall)
ENABLE_TESTING()

####################################################################
# Dependencies
#

## Requires
MANAGE_DEPENDENCY(REQUIRES CMAKE VER "2.6.2")
MANAGE_DEPENDENCY(REQUIRES GIT)

MANAGE_DEPENDENCY(REQUIRES BODHI-CLIENT)
MANAGE_DEPENDENCY(REQUIRES KOJI)
MANAGE_DEPENDENCY(REQUIRES RPM-BUILD)
MANAGE_DEPENDENCY(REQUIRES FEDPKG)
MANAGE_DEPENDENCY(REQUIRES FEDORA-PACKAGER)
MANAGE_DEPENDENCY(REQUIRES CURL)
MANAGE_DEPENDENCY(REQUIRES PACKAGEDB-CLI)

## Build requires
MANAGE_DEPENDENCY(BUILD_REQUIRES CMAKE VER "2.6.2" REQUIRED)
MANAGE_DEPENDENCY(BUILD_REQUIRES KOJI REQUIRED)


####################################################################
# Building
#


####################################################################
# Installing
#

INSTALL(FILES AUTHORS README ChangeLog COPYING 
    DESTINATION ${PRJ_DOC_DIR}
    )
INSTALL(FILES cmake-fedora.conf
    DESTINATION ${SYSCONF_DIR}
    )

ADD_SUBDIRECTORY(Modules)
ADD_SUBDIRECTORY(scripts)
ADD_SUBDIRECTORY(Templates)

MANAGE_SOURCE_VERSION_CONTROL_GIT()

####################################################################
# Packing
#

ADD_CUSTOM_TARGET(test_all
    COMMAND ctest -C Debug --output-on-failure
    COMMENT "ctest: Run tests"
    )
ADD_DEPENDENCIES(pack_src_pre test_all)

## Pack Source 
SET(SOURCE_ARCHIVE_DIR ${CMAKE_BINARY_DIR}/SOURCES CACHE PATH "Source Archive Dir")
PACK_SOURCE_ARCHIVE("${SOURCE_ARCHIVE_DIR}"
    GITIGNORE ${CMAKE_SOURCE_DIR}/.gitignore
    )

IF(CMAKE_FEDORA_ENABLE_FEDORA_BUILD)
    SET(RPM_BUILD_SOURCES ${SOURCE_ARCHIVE_DIR})
    INCLUDE(ManageRPM)
    RPM_SPEC_STRING_ADD_DIRECTIVE(RPM_SPEC_SCRIPT_OUTPUT check "" "ctest --output-on-failure")
    PACK_RPM(SPEC_IN "Templates/fedora/project.spec.in")
    RPM_MOCK_BUILD()
ENDIF(CMAKE_FEDORA_ENABLE_FEDORA_BUILD)

####################################################################
# Hosting 
#
INCLUDE(ManageUpload)
ADD_CUSTOM_TARGET(upload
    COMMENT "Uploading all files"
    )

MANAGE_UPLOAD_FEDORAHOSTED(upload_fedorahosted_src)
ADD_DEPENDENCIES(upload upload_fedorahosted_src)

####################################################################
# Custom
#

# Module-only tarballs
INCLUDE(ManageTarget)
SET(MODULE_ONLY_ARCHIVE ${PROJECT_NAME}-${PRJ_VER}-modules-only.tar.gz)
SET(MODULE_ONLY_LATEST_ARCHIVE ${PROJECT_NAME}-modules-only-latest.tar.gz)
ADD_CUSTOM_TARGET_COMMAND(module-only
    OUTPUT ${MODULE_ONLY_ARCHIVE} ${MODULE_ONLY_LATEST_ARCHIVE}
    COMMAND tar --exclude=.* -czvf  ${MODULE_ONLY_ARCHIVE} Modules/*.cmake Modules/*.cmake.in
    COMMAND ln -sf ${MODULE_ONLY_ARCHIVE} ${MODULE_ONLY_LATEST_ARCHIVE}
    )

MANAGE_UPLOAD_FEDORAHOSTED(upload_fedorahosted_modules 
    UPLOAD_FILES ${MODULE_ONLY_ARCHIVE} ${MODULE_ONLY_LATEST_ARCHIVE}
    )
ADD_DEPENDENCIES(upload upload_fedorahosted_modules)

####################################################################
# Release
#

ADD_DEPENDENCIES(upload tag_push)
INCLUDE(ManageRelease)
IF(CMAKE_FEDORA_ENABLE_FEDORA_BUILD)
    INCLUDE(ManageReleaseFedora)
    RELEASE_FEDORA(fedora epel7 el6)
    # "Off" Warning is displayed if mock is not installed.
    MANAGE_RELEASE(upload tag_push release_fedora)
ELSE(CMAKE_FEDORA_ENABLE_FEDORA_BUILD)
    MANAGE_RELEASE(upload tag_push)
ENDIF(CMAKE_FEDORA_ENABLE_FEDORA_BUILD)

####################################################################
# Test Suites.
#
ADD_TEST("ManageString" ctest -S test/testManageString.cmake)
ADD_TEST("ManageVariable" ctest -S test/testManageVariable.cmake)
ADD_TEST("ManageFile" ctest -S test/testManageFile.cmake)
ADD_TEST("ManageTranslation" ctest -S test/testManageTranslation.cmake)
ADD_TEST("CmakeFedoraScript" ctest -S test/testCmakeFedoraScript.cmake)
ADD_TEST("CmakeFedoraKoji" ctest -S test/testCmakeFedoraKoji.cmake)
ADD_TEST("CmakeFedoraFedpkg" ctest -S test/testCmakeFedoraFedpkg.cmake)

IF(CMAKE_VERSION VERSION_GREATER 2.8.0)
    ## Use cmake 
    ADD_TEST(NAME "ManageZanata" 
	CONFIGURATIONS "Debug"
	COMMAND ctest -S test/testManageZanata.cmake)
    ADD_TEST(NAME "cmake-fedora-newprj"
	CONFIGURATIONS "Debug"
	COMMAND ctest -S test/testCmakeFedoraNewprj.cmake
	)
ENDIF(CMAKE_VERSION VERSION_GREATER 2.8.0)