at master 3.0 kB view raw
1diff --git a/CMakeLists.txt b/CMakeLists.txt 2index 4ec0f64..48b619a 100644 3--- a/CMakeLists.txt 4+++ b/CMakeLists.txt 5@@ -39,3 +39,54 @@ add_subdirectory(cmake/dependencies dependencies) 6 set(TOP_LEVEL_DIR ${CMAKE_CURRENT_LIST_DIR}) 7 include_directories(${TOP_LEVEL_DIR} ${pybind11_INCLUDE_DIRS}) 8 add_subdirectory(pybind11_protobuf) 9+ 10+# ============================================================================ 11+ 12+# pybind11_protobuf CMake Config module 13+include(CMakePackageConfigHelpers) 14+configure_package_config_file( 15+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake.in 16+ "${CMAKE_CURRENT_BINARY_DIR}/pybind11_protobuf-config.cmake" 17+ INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pybind11_protobuf 18+ NO_CHECK_REQUIRED_COMPONENTS_MACRO) 19+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pybind11_protobuf-config.cmake" 20+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pybind11_protobuf) 21+ 22+# ============================================================================ 23+ 24+add_library(pybind11_protobuf::native ALIAS pybind11_native_proto_caster) 25+ 26+install( 27+ TARGETS pybind11_native_proto_caster 28+ EXPORT pybind11_protobuf_native_targets 29+ DESTINATION ${CMAKE_INSTALL_LIBDIR} 30+ INCLUDES 31+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/pybind11_protobuf) 32+install( 33+ FILES pybind11_protobuf/native_proto_caster.h 34+ pybind11_protobuf/check_unknown_fields.h 35+ pybind11_protobuf/enum_type_caster.h 36+ pybind11_protobuf/proto_caster_impl.h 37+ pybind11_protobuf/proto_cast_util.h 38+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/pybind11_protobuf) 39+install( 40+ EXPORT pybind11_protobuf_native_targets 41+ FILE pybind11_protobuf_native-targets.cmake 42+ NAMESPACE pybind11_protobuf:: 43+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pybind11_protobuf) 44+ 45+add_library(pybind11_protobuf::wrapped ALIAS pybind11_wrapped_proto_caster) 46+ 47+install( 48+ TARGETS pybind11_wrapped_proto_caster 49+ EXPORT pybind11_protobuf_wrapped_targets 50+ DESTINATION ${CMAKE_INSTALL_LIBDIR} 51+ INCLUDES 52+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/pybind11_protobuf) 53+install(FILES pybind11_protobuf/wrapped_proto_caster.h 54+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/pybind11_protobuf) 55+install( 56+ EXPORT pybind11_protobuf_wrapped_targets 57+ FILE pybind11_protobuf_wrapped-targets.cmake 58+ NAMESPACE pybind11_protobuf:: 59+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pybind11_protobuf) 60diff --git a/cmake/Config.cmake.in b/cmake/Config.cmake.in 61new file mode 100644 62index 0000000..00dae69 63--- /dev/null 64+++ b/cmake/Config.cmake.in 65@@ -0,0 +1,13 @@ 66+@PACKAGE_INIT@ 67+ 68+set(_pybind11_protobuf_supported_components native wrapped) 69+ 70+foreach(_comp ${pybind11_protobuf_FIND_COMPONENTS}) 71+ if(NOT _comp IN_LIST _pybind11_protobuf_supported_components) 72+ set(pybind11_protobuf_FOUND False) 73+ set(pybind11_protobuf_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}") 74+ endif() 75+endforeach() 76+foreach(_comp ${_pybind11_protobuf_supported_components}) 77+ include("${CMAKE_CURRENT_LIST_DIR}/pybind11_protobuf_${_comp}-targets.cmake") 78+endforeach()