File: CMakeLists.txt

package info (click to toggle)
openmolcas 20.10-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 156,232 kB
  • sloc: fortran: 720,814; f90: 21,642; python: 8,819; ansic: 5,797; perl: 1,791; sh: 942; pascal: 459; javascript: 272; makefile: 17
file content (54 lines) | stat: -rw-r--r-- 2,221 bytes parent folder | download
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
#***********************************************************************
# This file is part of OpenMolcas.                                     *
#                                                                      *
# OpenMolcas is free software; you can redistribute it and/or modify   *
# it under the terms of the GNU Lesser General Public License, v. 2.1. *
# OpenMolcas is distributed in the hope that it will be useful, but it *
# is provided "as is" and without any express or implied warranties.   *
# For more details see the full text of the license in the file        *
# LICENSE or in <http://www.gnu.org/licenses/>.                        *
#                                                                      *
# Copyright (C) 2017, Ignacio Fdez. Galván                             *
#***********************************************************************
if (NOT DEFINED BASE_DIR)
        set (BASE_DIR ${PROJECT_SOURCE_DIR})
endif ()
file (RELATIVE_PATH tooldir ${BASE_DIR} ${CMAKE_CURRENT_LIST_DIR})
set (OUTPUT_PATH ${PROJECT_BINARY_DIR}/${tooldir})

file (GLOB py_sources "*.py")
list (REMOVE_ITEM py_sources "${CMAKE_CURRENT_LIST_DIR}/pack.py")

if (NOT PYTHONINTERP_FOUND)
        set (dir_error "disabled (no appropriate python interpreter found)" PARENT_SCOPE)
        return()
endif ()

set (PYTHONINTERP_FOUND "${PYTHONINTERP_FOUND}" PARENT_SCOPE)

execute_process (
        COMMAND ${PYTHON_EXECUTABLE} imports.py
        WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
        OUTPUT_VARIABLE PYMOLCAS_IMPORT_OUTPUT
        RESULT_VARIABLE PYMOLCAS_IMPORT_RC
        OUTPUT_STRIP_TRAILING_WHITESPACE
        )

if (PYMOLCAS_IMPORT_RC)
        message (WARNING "Some python modules are not available: ${PYMOLCAS_IMPORT_OUTPUT}")
        set (dir_error "disabled" PARENT_SCOPE)
        return()
endif ()

set (PYMOLCAS_TARGET "${OUTPUT_PATH}/pymolcas_")
set (PYMOLCAS_TARGET "${PYMOLCAS_TARGET}" PARENT_SCOPE)

add_custom_command (OUTPUT ${PYMOLCAS_TARGET}
COMMAND ${PYTHON_EXECUTABLE} export.py ${PYMOLCAS_TARGET}
                WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
        DEPENDS ${py_sources}
        )

add_custom_target (pymolcas ALL
        DEPENDS ${PYMOLCAS_TARGET}
        )