summaryrefslogtreecommitdiff
path: root/sci-libs/pastix/files/pastix-6.0.3-cmake-python-optional.patch
blob: 71d356fae2f1e24db95c894c92b927cb9cda57da (plain)
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
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -100,6 +100,9 @@
 option(PASTIX_WITH_FORTRAN
   "Enable Fortran files/interface/examples to be compiled" ON)
 
+option(PASTIX_WITH_PYTHON
+  "Install Python wrapper and examples" ON)
+
 cmake_dependent_option(PASTIX_DISTRIBUTED
  "Enable the distributed interface (requires PASTIX_WITH_MPI)" OFF "PASTIX_WITH_MPI" OFF)
 
--- a/spm/CMakeLists.txt
+++ b/spm/CMakeLists.txt
@@ -83,6 +83,13 @@
     "Enable Fortran files/interface/examples to be compiled" ON)
 endif()
 
+if ( DEFINED PASTIX_WITH_PYTHON )
+  set( SPM_WITH_PYTHON ${PASTIX_WITH_PYTHON} )
+else()
+  option(SPM_WITH_PYTHON
+    "Install Python wrapper and examples" ON)
+endif()
+
 if (SPM_WITH_FORTRAN)
   include(FortranCInterface)
   FortranCInterface_HEADER(src/FCmangle.h
--- a/spm/wrappers/CMakeLists.txt
+++ b/spm/wrappers/CMakeLists.txt
@@ -13,8 +13,10 @@
   add_subdirectory( fortran90 )
 endif()
 
-if (BUILD_SHARED_LIBS)
-  add_subdirectory( python )
-else()
-  message(STATUS "--- Python wrapper is disabled with static libraries")
-endif()
+if (SPM_WITH_PYTHON)
+  if (BUILD_SHARED_LIBS)
+    add_subdirectory( python )
+  else (BUILD_SHARED_LIBS)
+    message(FATAL_ERROR "--- Python wrapper requested but it cannot be built with static libraries")
+  endif (BUILD_SHARED_LIBS)
+endif (SPM_WITH_PYTHON)
--- a/wrappers/CMakeLists.txt
+++ b/wrappers/CMakeLists.txt
@@ -13,8 +13,10 @@
   add_subdirectory( fortran90 )
 endif()
 
-if (BUILD_SHARED_LIBS)
-  add_subdirectory( python )
-else()
-  message(STATUS "--- Python wrapper is disabled with static libraries")
-endif()
+if (PASTIX_WITH_PYTHON)
+  if (BUILD_SHARED_LIBS)
+    add_subdirectory( python )
+  else (BUILD_SHARED_LIBS)
+    message(FATAL_ERROR "--- Python wrapper requested but it cannot be built with static libraries")
+  endif (BUILD_SHARED_LIBS)
+endif (PASTIX_WITH_PYTHON)