diff --git a/CMakeLists.txt b/CMakeLists.txt index d5bfa47f..e4c5dd31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,11 +10,18 @@ if(COMMAND register_component) register_component() else() add_library(u8g2 ${COMPONENT_SRCS}) - target_include_directories(u8g2 PUBLIC ${CMAKE_CURRENT_LIST_DIR}/csrc ) + target_include_directories(u8g2 PUBLIC "$" "$") endif() install(TARGETS u8g2 + EXPORT u8g2-targets ARCHIVE DESTINATION lib) install(FILES ${COMPONENT_HDRS} DESTINATION include/u8g2) + +install(EXPORT u8g2-targets + DESTINATION lib/cmake/u8g2) + +install(FILES ${u8g2_SOURCE_DIR}/pkg/u8g2-config.cmake + DESTINATION lib/cmake/u8g2) diff --git a/pkg/u8g2-config.cmake b/pkg/u8g2-config.cmake new file mode 100644 index 00000000..8b25e05f --- /dev/null +++ b/pkg/u8g2-config.cmake @@ -0,0 +1,6 @@ +get_filename_component(_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(_prefix "${_dir}/../../.." ABSOLUTE) + +include("${_prefix}/lib/cmake/u8g2/u8g2-targets.cmake") + +set(u8g2_INCLUDE_DIRS "${_prefix}/include/u8g2")