aboutsummaryrefslogtreecommitdiff
path: root/attic/modules/PythonMacros.cmake
diff options
context:
space:
mode:
authorChristophe Giboudeaux <christophe@krop.fr>2021-03-29 20:28:58 +0200
committerChristophe Giboudeaux <christophe@krop.fr>2021-04-06 19:59:17 +0000
commit272352969834598cfd20f3e8b15916aa3ccebbbb (patch)
treed0d831203f0816ee2d4edecb526cdbdec64ea3d4 /attic/modules/PythonMacros.cmake
parentd88db6a1469bdcb48e64f265d35a6f7867767b54 (diff)
downloadextra-cmake-modules-272352969834598cfd20f3e8b15916aa3ccebbbb.tar.gz
extra-cmake-modules-272352969834598cfd20f3e8b15916aa3ccebbbb.tar.bz2
Clean ECM's attic
Diffstat (limited to 'attic/modules/PythonMacros.cmake')
-rw-r--r--attic/modules/PythonMacros.cmake62
1 files changed, 0 insertions, 62 deletions
diff --git a/attic/modules/PythonMacros.cmake b/attic/modules/PythonMacros.cmake
deleted file mode 100644
index 0abaccbd..00000000
--- a/attic/modules/PythonMacros.cmake
+++ /dev/null
@@ -1,62 +0,0 @@
-# Python macros
-# ~~~~~~~~~~~~~
-# Copyright (c) 2007, Simon Edwards <simon@simonzone.com>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-#
-# This file defines the following macros:
-#
-# PYTHON_INSTALL (SOURCE_FILE DESINATION_DIR)
-# Install the SOURCE_FILE, which is a Python .py file, into the
-# destination directory during install. The file will be byte compiled
-# and both the .py file and .pyc file will be installed.
-
-GET_FILENAME_COMPONENT(PYTHON_MACROS_MODULE_PATH ${CMAKE_CURRENT_LIST_FILE} PATH)
-
-MACRO(PYTHON_INSTALL SOURCE_FILE DESINATION_DIR)
-
- FIND_FILE(_python_compile_py PythonCompile.py PATHS ${CMAKE_MODULE_PATH})
-
- ADD_CUSTOM_TARGET(compile_python_files ALL)
-
- # Install the source file.
- INSTALL(FILES ${SOURCE_FILE} DESTINATION ${DESINATION_DIR})
-
- # Byte compile and install the .pyc file.
- GET_FILENAME_COMPONENT(_absfilename ${SOURCE_FILE} ABSOLUTE)
- GET_FILENAME_COMPONENT(_filename ${SOURCE_FILE} NAME)
- GET_FILENAME_COMPONENT(_filenamebase ${SOURCE_FILE} NAME_WE)
- GET_FILENAME_COMPONENT(_basepath ${SOURCE_FILE} PATH)
-
- if(WIN32)
- string(REGEX REPLACE ".:/" "/" _basepath "${_basepath}")
- endif()
-
- SET(_bin_py ${CMAKE_CURRENT_BINARY_DIR}/${_basepath}/${_filename})
- SET(_bin_pyc ${CMAKE_CURRENT_BINARY_DIR}/${_basepath}/${_filenamebase}.pyc)
-
- FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_basepath})
-
- SET(_message "-DMESSAGE=Byte-compiling ${_bin_py}")
-
- GET_FILENAME_COMPONENT(_abs_bin_py ${_bin_py} ABSOLUTE)
- IF(_abs_bin_py STREQUAL ${_absfilename}) # Don't copy the file onto itself.
- ADD_CUSTOM_COMMAND(
- TARGET compile_python_files
- COMMAND ${CMAKE_COMMAND} -E echo ${message}
- COMMAND ${PYTHON_EXECUTABLE} ${_python_compile_py} ${_bin_py}
- DEPENDS ${_absfilename}
- )
- ELSE(_abs_bin_py STREQUAL ${_absfilename})
- ADD_CUSTOM_COMMAND(
- TARGET compile_python_files
- COMMAND ${CMAKE_COMMAND} -E echo ${message}
- COMMAND ${CMAKE_COMMAND} -E copy ${_absfilename} ${_bin_py}
- COMMAND ${PYTHON_EXECUTABLE} ${_python_compile_py} ${_bin_py}
- DEPENDS ${_absfilename}
- )
- ENDIF(_abs_bin_py STREQUAL ${_absfilename})
-
- INSTALL(FILES ${_bin_pyc} DESTINATION ${DESINATION_DIR})
-ENDMACRO(PYTHON_INSTALL)