File tree 1 file changed +28
-10
lines changed
1 file changed +28
-10
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ project(matplotlib_cpp LANGUAGES CXX)
4
4
include (GNUInstallDirs)
5
5
set (PACKAGE_NAME matplotlib_cpp)
6
6
set (INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR} /${PACKAGE_NAME} /cmake)
7
-
7
+ set (USING_PYTHON3 True )
8
8
9
9
# Library target
10
10
add_library (matplotlib_cpp INTERFACE )
@@ -17,19 +17,37 @@ target_compile_features(matplotlib_cpp INTERFACE
17
17
cxx_std_11
18
18
)
19
19
# TODO: Use `Development.Embed` component when requiring cmake >= 3.18
20
- find_package (Python3 COMPONENTS Interpreter Development REQUIRED)
21
- target_link_libraries (matplotlib_cpp INTERFACE
22
- Python3::Python
23
- Python3::Module
24
- )
25
- find_package (Python3 COMPONENTS NumPy)
26
- if (Python3_NumPy_FOUND)
20
+ if (USING_PYTHON3)
21
+ find_package (Python3 COMPONENTS Interpreter Development REQUIRED)
27
22
target_link_libraries (matplotlib_cpp INTERFACE
28
- Python3::NumPy
23
+ Python3::Python
24
+ Python3::Module
29
25
)
26
+ find_package (Python3 COMPONENTS NumPy)
27
+ if (Python3_NumPy_FOUND)
28
+ target_link_libraries (matplotlib_cpp INTERFACE
29
+ Python3::NumPy
30
+ )
31
+ else ()
32
+ target_compile_definitions (matplotlib_cpp INTERFACE WITHOUT_NUMPY)
33
+ endif ()
30
34
else ()
31
- target_compile_definitions (matplotlib_cpp INTERFACE WITHOUT_NUMPY)
35
+ find_package (Python2 COMPONENTS Interpreter Development REQUIRED)
36
+ target_link_libraries (matplotlib_cpp INTERFACE
37
+ Python2::Python
38
+ Python2::Module
39
+ )
40
+ find_package (Python2 COMPONENTS NumPy)
41
+ if (Python2_NumPy_FOUND)
42
+ target_link_libraries (matplotlib_cpp INTERFACE
43
+ Python2::NumPy
44
+ )
45
+ else ()
46
+ target_compile_definitions (matplotlib_cpp INTERFACE WITHOUT_NUMPY)
47
+ endif ()
32
48
endif ()
49
+
50
+
33
51
install (
34
52
TARGETS matplotlib_cpp
35
53
EXPORT install_targets
You can’t perform that action at this time.
0 commit comments