Skip to content

Commit d29f1fb

Browse files
committed
updated CMakeLists.txt
Signed-off-by: soblin <hilo.soblin@gmail.com>
1 parent 8490dcf commit d29f1fb

File tree

3 files changed

+9
-17
lines changed

3 files changed

+9
-17
lines changed

CMakeLists.txt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@ else()
3333
set(MATPLOTLIB_MINOR_VER_GTE_4 1)
3434
endif()
3535

36-
target_include_directories(
37-
${PROJECT_NAME}
38-
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
39-
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
40-
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17)
41-
4236
# ##############################################################################
4337
# (2) for add_subdirectory
4438
# ##############################################################################
@@ -89,6 +83,12 @@ set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
8983
# create .deb
9084
include("${PROJECT_SOURCE_DIR}/cmake/package.cmake")
9185

86+
target_include_directories(
87+
${PROJECT_NAME}
88+
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
89+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
90+
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17)
91+
9292
# ##############################################################################
9393
# (4) uninstall
9494
# ##############################################################################
@@ -125,9 +125,7 @@ endif()
125125

126126
function(add_demo name path)
127127
add_executable(${name} ${path})
128-
target_include_directories(${name} PUBLIC ${Python3_INCLUDE_DIRS}
129-
${matplotlibcpp17_INCLUDE_DIRS})
130-
target_link_libraries(${name} ${Python3_LIBRARIES} pybind11::embed xtensor)
128+
target_link_libraries(${name} xtensor matplotlibcpp17::matplotlibcpp17)
131129
endfunction()
132130

133131
if(${ADD_DEMO})
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
# create library
22
add_library(test_shared_lib SHARED test_lib.cpp)
33
target_compile_options(test_shared_lib PUBLIC "-fPIC")
4-
target_include_directories(
5-
test_shared_lib PUBLIC ${Python3_INCLUDE_DIRS}
6-
${matplotlibcpp17_INCLUDE_DIRS})
7-
target_link_libraries(test_shared_lib ${Python3_LIBRARIES} pybind11::embed)
4+
target_link_libraries(test_shared_lib matplotlibcpp17::matplotlibcpp17)
85
# link it
96
add_executable(test_lib_main test_lib_main.cpp)
107
target_link_libraries(test_lib_main test_shared_lib)
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
# create library
22
add_library(test_static_lib STATIC test_lib.cpp)
33
target_compile_options(test_static_lib PUBLIC "-fPIC")
4-
target_include_directories(
5-
test_static_lib PUBLIC ${Python3_INCLUDE_DIRS}
6-
${matplotlibcpp17_INCLUDE_DIRS})
7-
target_link_libraries(test_static_lib ${Python3_LIBRARIES} pybind11::embed)
4+
target_link_libraries(test_static_lib matplotlibcpp17::matplotlibcpp17)
85
# link it
96
add_executable(test_lib_static_main test_lib_main.cpp)
107
target_link_libraries(test_lib_static_main test_static_lib)

0 commit comments

Comments
 (0)