1# ##### BEGIN GPL LICENSE BLOCK #####
2#
3#  This program is free software; you can redistribute it and/or
4#  modify it under the terms of the GNU General Public License
5#  as published by the Free Software Foundation; either version 2
6#  of the License, or (at your option) any later version.
7#
8#  This program is distributed in the hope that it will be useful,
9#  but WITHOUT ANY WARRANTY; without even the implied warranty of
10#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11#  GNU General Public License for more details.
12#
13#  You should have received a copy of the GNU General Public License
14#  along with this program; if not, write to the Free Software Foundation,
15#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16#
17# ##### END GPL LICENSE BLOCK #####
18
19# This is a script which is used as POST-INSTALL one for regular CMake's
20# INSTALL target.
21# It is used by buildbot workers to sign every binary which is going into
22# the final buundle.
23
24# On Windows Python 3 there only is python.exe, no python3.exe.
25#
26# On other platforms it is possible to have python2 and python3, and a
27# symbolic link to python to either of them. So on those platforms use
28# an explicit Python version.
29if(WIN32)
30  set(PYTHON_EXECUTABLE python)
31else()
32  set(PYTHON_EXECUTABLE python3)
33endif()
34
35execute_process(
36  COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_LIST_DIR}/worker_codesign.py"
37          "${CMAKE_INSTALL_PREFIX}"
38  WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
39  RESULT_VARIABLE exit_code
40)
41
42if(NOT exit_code EQUAL "0")
43    message(FATAL_ERROR "Non-zero exit code of codesign tool")
44endif()
45