Skip to content

Commit

Permalink
[CMakeLists.txt] fix last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
2bndy5 committed Aug 15, 2021
1 parent 88645ac commit 6ff8bdd
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ set_project_warnings(${LibTargetName}_project_warnings)
# setup CPack options
include(${CMAKE_CURRENT_LIST_DIR}/cmake/CPackInfo.cmake)

find_library(RF24 rf24 REQUIRED)
message(STATUS "using RF24 library: ${RF24}")
if(NOT DEFINED USE_RF24_LIB_SRC)
find_library(RF24 rf24 REQUIRED)
message(STATUS "using RF24 library: ${RF24}")
endif()

###########################
# create target for bulding the RF24Log lib
Expand All @@ -80,23 +82,25 @@ target_include_directories(${LibTargetName} PUBLIC
${CMAKE_CURRENT_LIST_DIR}
)

target_link_libraries(${LibTargetName}
INTERFACE ${LibTargetName}_project_options
INTERFACE ${LibTargetName}_project_warnings
)

# python wrapper builds from source
if(DEFINED USE_RF24_LIB_SRC OR pybind11_FOUND OR SKBUILD)
message(STATUS "Building lib from RF24 source")
target_compile_definitions(${LibTargetName} PUBLIC USE_RF24_LIB_SRC)
target_link_libraries(${LibTargetName} INTERFACE rf24)
if(NOT DEFINED RF24_LIB_PATH)
target_include_directories(${LibTargetName} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../RF24)
else()
target_include_directories(${LibTargetName} PUBLIC ${RF24_LIB_PATH})
endif()
target_link_libraries(${LibTargetName}
INTERFACE ${LibTargetName}_project_options
INTERFACE ${LibTargetName}_project_warnings
)

else()
target_link_libraries(${LibTargetName} SHARED ${RF24})
target_link_libraries(${LibTargetName}
INTERFACE ${LibTargetName}_project_options
INTERFACE ${LibTargetName}_project_warnings
SHARED ${RF24}
)
endif()

set_target_properties(
Expand Down

0 comments on commit 6ff8bdd

Please sign in to comment.