summaryrefslogtreecommitdiff
path: root/ext/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt')
-rw-r--r--ext/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt25
1 files changed, 25 insertions, 0 deletions
diff --git a/ext/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt b/ext/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt
new file mode 100644
index 000000000..88ba60dd5
--- /dev/null
+++ b/ext/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt
@@ -0,0 +1,25 @@
+cmake_minimum_required(VERSION 3.0)
+project(test_subdirectory_embed CXX)
+
+set(PYBIND11_INSTALL ON CACHE BOOL "")
+set(PYBIND11_EXPORT_NAME test_export)
+
+add_subdirectory(${PYBIND11_PROJECT_DIR} pybind11)
+
+# Test basic target functionality
+add_executable(test_cmake_build ../embed.cpp)
+target_link_libraries(test_cmake_build PRIVATE pybind11::embed)
+
+add_custom_target(check $<TARGET_FILE:test_cmake_build> ${PROJECT_SOURCE_DIR}/../test.py)
+
+# Test custom export group -- PYBIND11_EXPORT_NAME
+add_library(test_embed_lib ../embed.cpp)
+target_link_libraries(test_embed_lib PRIVATE pybind11::embed)
+
+install(TARGETS test_embed_lib
+ EXPORT test_export
+ ARCHIVE DESTINATION bin
+ LIBRARY DESTINATION lib
+ RUNTIME DESTINATION lib)
+install(EXPORT test_export
+ DESTINATION lib/cmake/test_export/test_export-Targets.cmake)