This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to correctly include pc-ble-driver using cmake?

Hi,

I want to use the static version of pc-ble-driver in my c++ code. I am learning cmake but I have no expereince with Ninja. I'm using only the version 6 of the API. My cmake works and it looks like this:

find_library(LIBPC-BLE-DRIVER nrf-ble-driver-sd_api_v6 "${CMAKE_SOURCE_DIR}/libs/pc-ble-driver/")
set(PC-BLE-DRIVER-INCLUDE "${CMAKE_SOURCE_DIR}/libs/pc-ble-driver/includes/sd_api_v6" 
"${CMAKE_SOURCE_DIR}/libs/pc-ble-driver/includes/common" 
"${CMAKE_SOURCE_DIR}/libs/pc-ble-driver/includes/common/config"
"${CMAKE_SOURCE_DIR}/libs/pc-ble-driver/includes/common/internal"
"${CMAKE_SOURCE_DIR}/libs/pc-ble-driver/includes/common/sdk_compat")

target_include_directories(myProject PUBLIC "${PC-BLE-DRIVER-INCLUDE}")

target_link_libraries(myProject -lpthread ${LIBPC-BLE-DRIVER} -ludev)

... however, I am looking for the code to do it using find_package() (and also with the static version that I am using). Do I have to previously install the library using something similar to make install? Can someone give me a hand?

Thanks in advance

Related