Skip to content

Commit ff0248f

Browse files
author
soblin
committed
(1) disable flags OFF (2) set matplotlibcpp17::matplotlibcpp17 target for add_subdirectory()
Signed-off-by: soblin <hilo.sobli@gmail.com>
1 parent 235674f commit ff0248f

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

CMakeLists.txt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ endif()
3434

3535
# gallery
3636
if(NOT DEFINED USE_GUI)
37-
set(USE_GUI 1)
38-
message(STATUS "set USE_GUI = ON")
37+
set(USE_GUI 0)
38+
message(STATUS "set USE_GUI = OFF")
3939
endif()
4040
if(NOT DEFINED ADD_DEMO)
41-
set(ADD_DEMO 1)
42-
message(STATUS "set ADD_DEMO = ON")
41+
set(ADD_DEMO 0)
42+
message(STATUS "set ADD_DEMO = OFF")
4343
endif()
4444
if(USE_GUI)
4545
message(STATUS "USE_GUI = ON")
@@ -52,8 +52,6 @@ else()
5252
message(STATUS "ADD_DEMO = OFF")
5353
endif()
5454

55-
set(matplotlibcpp17_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include")
56-
5755
function(add_demo name path)
5856
add_executable(${name} ${path})
5957
target_include_directories(${name} PUBLIC ${Python3_INCLUDE_DIRS}
@@ -82,6 +80,11 @@ if(${ADD_DEMO})
8280
add_subdirectory(gallery/scales)
8381
endif()
8482

83+
# for add_subdirectory
84+
add_library(matplotlibcpp17::matplotlibcpp17 INTERFACE IMPORTED GLOBAL)
85+
set_property(TARGET matplotlibcpp17::matplotlibcpp17 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/include ${Python3_INCLUDE_DIRS})
86+
set_property(TARGET matplotlibcpp17::matplotlibcpp17 PROPERTY INTERFACE_LINK_LIBRARIES ${Python3_LIBRARIES} pybind11::embed)
87+
8588
# install https://dominikberner.ch/cmake-interface-lib/
8689
include(GNUInstallDirs)
8790
add_library(${PROJECT_NAME} INTERFACE)

0 commit comments

Comments
 (0)