@@ -5,6 +5,7 @@ include(GNUInstallDirs)
55set (PACKAGE_NAME matplotlib_cpp)
66set (INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR} /${PACKAGE_NAME} /cmake)
77
8+ option (MATPLOTLIBCPP_BUILD_EXAMPLES "Compile example programs" ON )
89
910# Library target
1011add_library (matplotlib_cpp INTERFACE )
@@ -37,72 +38,73 @@ install(
3738
3839
3940# Examples
40- add_executable (minimal examples/minimal.cpp )
41- target_link_libraries (minimal PRIVATE matplotlib_cpp )
42- set_target_properties (minimal PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
43-
44- add_executable (basic examples/basic.cpp )
45- target_link_libraries (basic PRIVATE matplotlib_cpp )
46- set_target_properties (basic PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
47-
48- add_executable (modern examples/modern.cpp )
49- target_link_libraries (modern PRIVATE matplotlib_cpp )
50- set_target_properties (modern PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
51-
52- add_executable (animation examples/animation.cpp )
53- target_link_libraries (animation PRIVATE matplotlib_cpp )
54- set_target_properties (animation PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
55-
56- add_executable (nonblock examples/nonblock.cpp )
57- target_link_libraries (nonblock PRIVATE matplotlib_cpp )
58- set_target_properties (nonblock PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
59-
60- add_executable (xkcd examples/xkcd.cpp )
61- target_link_libraries (xkcd PRIVATE matplotlib_cpp )
62- set_target_properties (xkcd PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
63-
64- add_executable (bar examples/bar.cpp )
65- target_link_libraries (bar PRIVATE matplotlib_cpp )
66- set_target_properties (bar PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
67-
68- add_executable (fill_inbetween examples/fill_inbetween.cpp )
69- target_link_libraries (fill_inbetween PRIVATE matplotlib_cpp )
70- set_target_properties (fill_inbetween PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
71-
72- add_executable (fill examples/fill.cpp )
73- target_link_libraries (fill PRIVATE matplotlib_cpp )
74- set_target_properties (fill PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
75-
76- add_executable (update examples/update.cpp )
77- target_link_libraries (update PRIVATE matplotlib_cpp )
78- set_target_properties (update PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
79-
80- add_executable (subplot2grid examples/subplot2grid.cpp )
81- target_link_libraries (subplot2grid PRIVATE matplotlib_cpp )
82- set_target_properties (subplot2grid PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
83-
84- add_executable (lines3d examples/lines3d.cpp )
85- target_link_libraries (lines3d PRIVATE matplotlib_cpp )
86- set_target_properties (lines3d PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
87-
88- if (Python3_NumPy_FOUND)
89- add_executable (surface examples/surface.cpp )
90- target_link_libraries (surface PRIVATE matplotlib_cpp )
91- set_target_properties (surface PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
92-
93- add_executable (colorbar examples/colorbar.cpp )
94- target_link_libraries (colorbar PRIVATE matplotlib_cpp )
95- set_target_properties (colorbar PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
96- add_executable (contour examples/contour.cpp )
97- target_link_libraries (contour PRIVATE matplotlib_cpp )
98- set_target_properties (contour PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
99-
100- add_executable (spy examples/spy.cpp )
101- target_link_libraries (spy PRIVATE matplotlib_cpp )
102- set_target_properties (spy PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
41+ if (MATPLOTLIBCPP_BUILD_EXAMPLES)
42+ add_executable (minimal examples/minimal.cpp )
43+ target_link_libraries (minimal PRIVATE matplotlib_cpp )
44+ set_target_properties (minimal PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
45+
46+ add_executable (basic examples/basic.cpp )
47+ target_link_libraries (basic PRIVATE matplotlib_cpp )
48+ set_target_properties (basic PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
49+
50+ add_executable (modern examples/modern.cpp )
51+ target_link_libraries (modern PRIVATE matplotlib_cpp )
52+ set_target_properties (modern PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
53+
54+ add_executable (animation examples/animation.cpp )
55+ target_link_libraries (animation PRIVATE matplotlib_cpp )
56+ set_target_properties (animation PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
57+
58+ add_executable (nonblock examples/nonblock.cpp )
59+ target_link_libraries (nonblock PRIVATE matplotlib_cpp )
60+ set_target_properties (nonblock PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
61+
62+ add_executable (xkcd examples/xkcd.cpp )
63+ target_link_libraries (xkcd PRIVATE matplotlib_cpp )
64+ set_target_properties (xkcd PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
65+
66+ add_executable (bar examples/bar.cpp )
67+ target_link_libraries (bar PRIVATE matplotlib_cpp )
68+ set_target_properties (bar PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
69+
70+ add_executable (fill_inbetween examples/fill_inbetween.cpp )
71+ target_link_libraries (fill_inbetween PRIVATE matplotlib_cpp )
72+ set_target_properties (fill_inbetween PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
73+
74+ add_executable (fill examples/fill.cpp )
75+ target_link_libraries (fill PRIVATE matplotlib_cpp )
76+ set_target_properties (fill PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
77+
78+ add_executable (update examples/update.cpp )
79+ target_link_libraries (update PRIVATE matplotlib_cpp )
80+ set_target_properties (update PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
81+
82+ add_executable (subplot2grid examples/subplot2grid.cpp )
83+ target_link_libraries (subplot2grid PRIVATE matplotlib_cpp )
84+ set_target_properties (subplot2grid PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
85+
86+ add_executable (lines3d examples/lines3d.cpp )
87+ target_link_libraries (lines3d PRIVATE matplotlib_cpp )
88+ set_target_properties (lines3d PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
89+
90+ if (Python3_NumPy_FOUND)
91+ add_executable (surface examples/surface.cpp )
92+ target_link_libraries (surface PRIVATE matplotlib_cpp )
93+ set_target_properties (surface PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
94+
95+ add_executable (colorbar examples/colorbar.cpp )
96+ target_link_libraries (colorbar PRIVATE matplotlib_cpp )
97+ set_target_properties (colorbar PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
98+ add_executable (contour examples/contour.cpp )
99+ target_link_libraries (contour PRIVATE matplotlib_cpp )
100+ set_target_properties (contour PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
101+
102+ add_executable (spy examples/spy.cpp )
103+ target_link_libraries (spy PRIVATE matplotlib_cpp )
104+ set_target_properties (spy PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR } /bin" )
105+ endif ()
103106endif ()
104107
105-
106108# Install headers
107109install (FILES
108110 "${PROJECT_SOURCE_DIR } /matplotlibcpp.h"
0 commit comments