File tree Expand file tree Collapse file tree 1 file changed +28
-10
lines changed
Expand file tree Collapse file tree 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)
44include (GNUInstallDirs)
55set (PACKAGE_NAME matplotlib_cpp)
66set (INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR} /${PACKAGE_NAME} /cmake)
7-
7+ set (USING_PYTHON3 True )
88
99# Library target
1010add_library (matplotlib_cpp INTERFACE )
@@ -17,19 +17,37 @@ target_compile_features(matplotlib_cpp INTERFACE
1717 cxx_std_17
1818)
1919# 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)
2722 target_link_libraries (matplotlib_cpp INTERFACE
28- Python3::NumPy
23+ Python3::Python
24+ Python3::Module
2925 )
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 ()
3034else ()
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 ()
3248endif ()
49+
50+
3351install (
3452 TARGETS matplotlib_cpp
3553 EXPORT install_targets
You can’t perform that action at this time.
0 commit comments