Skip to content

Commit

Permalink
updated CMakeLists.txt
Browse files Browse the repository at this point in the history
Signed-off-by: soblin <[email protected]>
  • Loading branch information
soblin committed Oct 21, 2022
1 parent 8490dcf commit d29f1fb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
16 changes: 7 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ else()
set(MATPLOTLIB_MINOR_VER_GTE_4 1)
endif()

target_include_directories(
${PROJECT_NAME}
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17)

# ##############################################################################
# (2) for add_subdirectory
# ##############################################################################
Expand Down Expand Up @@ -89,6 +83,12 @@ set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
# create .deb
include("${PROJECT_SOURCE_DIR}/cmake/package.cmake")

target_include_directories(
${PROJECT_NAME}
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17)

# ##############################################################################
# (4) uninstall
# ##############################################################################
Expand Down Expand Up @@ -125,9 +125,7 @@ endif()

function(add_demo name path)
add_executable(${name} ${path})
target_include_directories(${name} PUBLIC ${Python3_INCLUDE_DIRS}
${matplotlibcpp17_INCLUDE_DIRS})
target_link_libraries(${name} ${Python3_LIBRARIES} pybind11::embed xtensor)
target_link_libraries(${name} xtensor matplotlibcpp17::matplotlibcpp17)
endfunction()

if(${ADD_DEMO})
Expand Down
5 changes: 1 addition & 4 deletions gallery/tests/test_shared_lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# create library
add_library(test_shared_lib SHARED test_lib.cpp)
target_compile_options(test_shared_lib PUBLIC "-fPIC")
target_include_directories(
test_shared_lib PUBLIC ${Python3_INCLUDE_DIRS}
${matplotlibcpp17_INCLUDE_DIRS})
target_link_libraries(test_shared_lib ${Python3_LIBRARIES} pybind11::embed)
target_link_libraries(test_shared_lib matplotlibcpp17::matplotlibcpp17)
# link it
add_executable(test_lib_main test_lib_main.cpp)
target_link_libraries(test_lib_main test_shared_lib)
5 changes: 1 addition & 4 deletions gallery/tests/test_static_lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# create library
add_library(test_static_lib STATIC test_lib.cpp)
target_compile_options(test_static_lib PUBLIC "-fPIC")
target_include_directories(
test_static_lib PUBLIC ${Python3_INCLUDE_DIRS}
${matplotlibcpp17_INCLUDE_DIRS})
target_link_libraries(test_static_lib ${Python3_LIBRARIES} pybind11::embed)
target_link_libraries(test_static_lib matplotlibcpp17::matplotlibcpp17)
# link it
add_executable(test_lib_static_main test_lib_main.cpp)
target_link_libraries(test_lib_static_main test_static_lib)

0 comments on commit d29f1fb

Please sign in to comment.