Open rursprung opened 1 year ago
currently there's no easy way to automate the integration of pigpio into other cmake projects.
using ExternalProject i found a way to do it. for this i created a cmake/Findpigpio.cmake in my project with the following content:
ExternalProject
cmake/Findpigpio.cmake
include(ExternalProject) ExternalProject_Add(pigpio GIT_REPOSITORY https://github.com/joan2937/pigpio.git GIT_TAG v79 CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> ) ExternalProject_Get_Property(pigpio INSTALL_DIR) set(pigpio_INCLUDE_DIR ${INSTALL_DIR}/include) set(pigpio_LIBRARIES ${INSTALL_DIR}/lib/libpigpio.so) mark_as_advanced(pigpio_INCLUDE_DIR pigpio_LIBRARIES)
afterwards i could use this in my main CMakeLists.txt:
CMakeLists.txt
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake) # [..] find_package(pigpio REQUIRED) # [..] include_directories( # [..] ${pigpio_INCLUDE_DIR} ) # [..] add_dependencies(${PROJECT_NAME} pigpio) # [..] target_link_libraries( ${PROJECT_NAME} # [..] ${pigpio_LIBRARIES} )
i think it'd be great if this project could ship something like this (i'm not sure if this is the best/proper way of doing it) so that others can pull it in more easily.
currently there's no easy way to automate the integration of pigpio into other cmake projects.
using
ExternalProject
i found a way to do it. for this i created acmake/Findpigpio.cmake
in my project with the following content:afterwards i could use this in my main
CMakeLists.txt
:i think it'd be great if this project could ship something like this (i'm not sure if this is the best/proper way of doing it) so that others can pull it in more easily.