From d29f1fb526d8a0ef520a399e3293e6a7d516bfdb Mon Sep 17 00:00:00 2001 From: soblin Date: Sat, 22 Oct 2022 08:27:33 +0900 Subject: [PATCH] updated CMakeLists.txt Signed-off-by: soblin --- CMakeLists.txt | 16 +++++++--------- gallery/tests/test_shared_lib/CMakeLists.txt | 5 +---- gallery/tests/test_static_lib/CMakeLists.txt | 5 +---- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index de4cc9e..5c46a8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,12 +33,6 @@ else() set(MATPLOTLIB_MINOR_VER_GTE_4 1) endif() -target_include_directories( - ${PROJECT_NAME} - INTERFACE $ - $) -target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17) - # ############################################################################## # (2) for add_subdirectory # ############################################################################## @@ -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 $ + $) +target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17) + # ############################################################################## # (4) uninstall # ############################################################################## @@ -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}) diff --git a/gallery/tests/test_shared_lib/CMakeLists.txt b/gallery/tests/test_shared_lib/CMakeLists.txt index 925d2dc..d677480 100644 --- a/gallery/tests/test_shared_lib/CMakeLists.txt +++ b/gallery/tests/test_shared_lib/CMakeLists.txt @@ -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) diff --git a/gallery/tests/test_static_lib/CMakeLists.txt b/gallery/tests/test_static_lib/CMakeLists.txt index 3955dfe..cd128e0 100644 --- a/gallery/tests/test_static_lib/CMakeLists.txt +++ b/gallery/tests/test_static_lib/CMakeLists.txt @@ -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)