Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a5cef23

Browse files
committed
CMakeLists for all executables in examples folder
1 parent b959de0 commit a5cef23

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

CMakeLists.txt

+1-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,4 @@ else()
2727
add_definitions(-DWITHOUT_NUMPY)
2828
endif()
2929

30-
# add_subdirectory("examples")
31-
set(CMAKE_CXX_STANDARD 17)
32-
add_executable(basic examples/basic.cpp matplotlibcpp.h)
33-
target_link_libraries(basic ${Python3_LIBRARIES})
30+
add_subdirectory(examples)

examples/CMakeLists.txt

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
function(add_example basename)
2+
# set C++ standard to C++17
3+
set(CMAKE_CXX_STANDARD 17)
4+
5+
# add WITH_EIGEN, if specified
6+
if(WITH_EIGEN)
7+
add_definitions("-DWITH_EIGEN")
8+
endif()
9+
10+
# add the exectuable and link it to the Python libs
11+
add_executable(${basename} ${basename}.cpp ../matplotlibcpp.h)
12+
target_link_libraries(${basename} ${Python3_LIBRARIES})
13+
endfunction(add_example)
14+
15+
# add the executables
16+
add_example(bar)
17+
add_example(basic)
18+
add_example(eigen)
19+
add_example(errorbar)
20+
add_example(fill_inbetween)
21+
add_example(fill)
22+
add_example(loglog)
23+
add_example(minimal)
24+
add_example(modern)
25+
add_example(nonblock)
26+
add_example(quiver)
27+
add_example(semilogx)
28+
add_example(semilogy)
29+
add_example(small)
30+
add_example(spy)
31+
add_example(subplot)
32+
add_example(surface)
33+
add_example(update)
34+
add_example(xkcd)

0 commit comments

Comments
 (0)