Skip to content

Commit

Permalink
update examples_RPi/CMakeLists.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
2bndy5 committed Jun 28, 2024
1 parent 75e435e commit d4e2a03
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions examples_RPi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,18 @@ elseif("${RF24_DRIVER}" STREQUAL "wiringPi")
else()
message(FATAL "Lib ${RF24_DRIVER} not found.")
endif()
elseif(NOT "${LibPIGPIO}" STREQUAL "LibPIGPIO-NOTFOUND" AND NOT DEFINED RF24_NO_INTERUPT)
if(NOT "${RF24_DRIVER}" STREQUAL "pigpio")
message(STATUS "linking to ${LibPIGPIO} for interrupt support")
else()
elseif("${RF24_DRIVER}" STREQUAL "pigpio")
if(NOT "${LibPIGPIO}" STREQUAL "LibPIGPIO-NOTFOUND")
message(STATUS "linking to ${LibPIGPIO}")
list(APPEND linked_libs ${LibPIGPIO})
else()
message(FATAL "Lib ${RF24_DRIVER} not found.")
endif()
list(APPEND linked_libs ${LibPIGPIO})
else()
message(STATUS "Disabling IRQ pin support")
endif()

foreach(example ${EXAMPLES_LIST})
# make a target
add_executable(${example} ${example}.cpp)
# link the RF24 lib to the target.
target_link_libraries(${example} PUBLIC ${linked_libs})
# conditionally disable interruot support (a pigpio specific feature)
if("${LibPIGPIO}" STREQUAL "LibPIGPIO-NOTFOUND" OR DEFINED RF24_NO_INTERRUPT)
target_compile_definitions(${example} PUBLIC RF24_NO_INTERRUPT)
endif()
endforeach()

0 comments on commit d4e2a03

Please sign in to comment.