Skip to content

Commit

Permalink
allow RF24_NO_IRQ for building examples
Browse files Browse the repository at this point in the history
  • Loading branch information
2bndy5 committed Jan 24, 2022
1 parent b78096d commit 296efb5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion examples_RPi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,24 @@ elseif("${RF24_DRIVER}" STREQUAL "wiringPi")
else()
message(FATAL "Lib ${RF24_DRIVER} not found.")
endif()
elseif(NOT "${LibPIGPIO}" STREQUAL "LibPIGPIO-NOTFOUND")
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()
message(STATUS "linking to ${LibPIGPIO}")
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 296efb5

Please sign in to comment.