Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkLanguageOptions.cmake
Go to the documentation of this file.
1 #
2 # This module finds the languages supported by MITK, and
3 # present the option to enable support.
4 #
5 
6 #
7 # This script is based on SimpleITK scripts.
8 #
9 
10 option(WRAP_DEFAULT "The default initial value for wrapping a language when it is detected on the system." OFF)
11 mark_as_advanced(WRAP_DEFAULT)
12 
13 #
14 # Macro to set "_QUIET" and "_QUIET_LIBRARY" based on the first
15 # argument being defined and true, to either REQUIRED or QUIET.
16 #
17 macro(set_QUIET var)
18  if ( DEFINED ${var} AND ${var} )
19  set( _QUIET "REQUIRED" )
20  else()
21  set( _QUIET "QUIET" )
22  endif()
23  if ( SITK_UNDEFINED_SYMBOLS_ALLOWED )
24  set( _QUIET_LIBRARY "QUIET" )
25  else()
26  set( _QUIET_LIBRARY ${_QUIET} )
27  endif()
28 endmacro()
29 
30 #
31 # Setup the option for each language
32 #
33 
34 #-----------------------------------------------------------
35 # Python
36 
37 set_QUIET( WRAP_PYTHON )
38 find_package ( PythonInterp ${_QUIET})
39 if ( PYTHONINTERP_FOUND )
40  find_package ( PythonLibs ${PYTHON_VERSION_STRING} EXACT ${_QUIET_LIBRARY} )
41 else ()
42  find_package ( PythonLibs ${_QUIET_LIBRARY} )
43 endif()
44 
45 if ( PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND
46  AND (PYTHON_VERSION_STRING VERSION_EQUAL PYTHONLIBS_VERSION_STRING) )
47  set( WRAP_PYTHON_DEFAULT ${WRAP_DEFAULT} )
48 else()
49  set( WRAP_PYTHON_DEFAULT OFF )
50 endif()
51 
52 option( WRAP_PYTHON "Wrap Python" ${WRAP_PYTHON_DEFAULT} )
53 
54 if ( WRAP_PYTHON AND PYTHON_VERSION_STRING VERSION_LESS 2.7 )
55  message( WARNING "Python version less than 2.7: \"${PYTHON_VERSION_STRING}\"." )
56 endif()
57 
58 if ( WRAP_PYTHON )
59  list( APPEND SITK_LANGUAGES_VARS
60  PYTHON_DEBUG_LIBRARY
61  PYTHON_EXECUTABLE
63  PYTHON_INCLUDE_DIR
64  )
65 # Debian "jessie" has this additional variable required to match
66 # python versions.
67  if(PYTHON_INCLUDE_DIR2)
68  list( APPEND SITK_LANGUAGES_VARS
69  PYTHON_INCLUDE_DIR2
70  )
71  endif()
72 endif ()
#define PYTHON_LIBRARY
Definition: PythonPath.h:7
set_QUIET(var)