Skip to content

Commit 40d4a43

Browse files
committed
Bit more like the other CMake PR, as they might no more what they're doing than I do.
1 parent 1e5bfc4 commit 40d4a43

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

CMakeLists.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.16)
22
project(matplotlib_cpp)
33

4-
set(CMAKE_CXX_STANDARD 14)
4+
set(CMAKE_CXX_STANDARD 11)
55

66
find_package(Python COMPONENTS Development NumPy)
77

@@ -12,17 +12,16 @@ message("Python_LIBRARIES:${Python_LIBRARIES}")
1212
message("Python_INCLUDE_DIRS:${Python_INCLUDE_DIRS}")
1313
message("Python_NumPy_INCLUDE_DIRS:${Python_NumPy_INCLUDE_DIRS}")
1414

15-
set(includes matplotlibcpp.h ${Python_INCLUDE_DIRS} ${Python_NumPy_INCLUDE_DIRS})
15+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/examples/build)
1616

17-
set(libraries ${Python_LIBRARIES})
17+
add_library(matplotlibcpp INTERFACE)
18+
target_include_directories(matplotlibcpp INTERFACE include ${Python_INCLUDE_DIRS} ${Python_NumPy_INCLUDE_DIRS})
19+
target_link_libraries(matplotlibcpp INTERFACE ${Python_LIBRARIES})
1820

1921
set(targets minimal basic animation bar colorbar fill fill_inbetween imshow
2022
lines3d modern nonblock quiver subplot subplot2grid surface update xkcd)
2123

22-
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/examples/build)
23-
2424
foreach(target ${targets})
2525
add_executable(${target} examples/${target}.cpp)
26-
target_include_directories(${target} PRIVATE ${includes})
27-
target_link_libraries(${target} ${libraries})
26+
target_link_libraries(${target} matplotlibcpp)
2827
endforeach()

0 commit comments

Comments
 (0)