Fixed hackrf-tools CMake scripts to build them out of tree.
This commit is contained in:
@ -40,6 +40,5 @@ include_directories(${LIBUSB_INCLUDE_DIR})
|
||||
|
||||
find_package(LIBHACKRF REQUIRED)
|
||||
include_directories(${LIBHACKRF_INCLUDE_DIR})
|
||||
link_directories(${LIBHACKRF_LIBRARIES} ${CMAKE_SOURCE_DIR}/../libhackrf/src)
|
||||
|
||||
add_subdirectory(src)
|
||||
|
@ -19,14 +19,33 @@ else (LIBHACKRF_INCLUDE_DIR AND LIBHACKRF_LIBRARIES)
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(PC_LIBHACKRF libhackrf)
|
||||
pkg_check_modules(PC_LIBHACKRF QUIET libhackrf)
|
||||
ENDIF(NOT WIN32)
|
||||
|
||||
FIND_PATH(LIBHACKRF_INCLUDE_DIR hackrf.h
|
||||
PATHS ${PC_LIBHACKRF_INCLUDEDIR} ${PC_LIBHACKRF_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/../libhackrf/src)
|
||||
FIND_PATH(LIBHACKRF_INCLUDE_DIR
|
||||
NAMES hackrf.h
|
||||
HINTS $ENV{LIBHACKRF_DIR}/include ${PC_LIBHACKRF_INCLUDEDIR}
|
||||
PATHS /usr/local/include/libhackrf /usr/local/include
|
||||
/usr/include ${CMAKE_SOURCE_DIR}/../libhackrf/src
|
||||
/opt/local/include/libhackrf
|
||||
${LIBHACKRF_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
FIND_LIBRARY(LIBHACKRF_LIBRARIES NAMES hackrf
|
||||
PATHS ${PC_LIBHACKRF_LIBDIR} ${PC_LIBHACKRF_LIBRARY_DIRS} ${CMAKE_SOURCE_DIR}/../libhackrf/src)
|
||||
set(libhackrf_library_names hackrf)
|
||||
|
||||
FIND_LIBRARY(LIBHACKRF_LIBRARIES
|
||||
NAMES ${libhackrf_library_names}
|
||||
HINTS $ENV{LIBHACKRF_DIR}/lib ${PC_LIBHACKRF_LIBDIR}
|
||||
PATHS /usr/local/lib /usr/lib /opt/local/lib ${PC_LIBHACKRF_LIBDIR} ${PC_LIBHACKRF_LIBRARY_DIRS} ${CMAKE_SOURCE_DIR}/../libhackrf/src
|
||||
)
|
||||
|
||||
if(LIBHACKRF_INCLUDE_DIR)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${LIBHACKRF_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
if(LIBHACKRF_LIBRARIES)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${LIBHACKRF_LIBRARIES})
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBHACKRF DEFAULT_MSG LIBHACKRF_LIBRARIES LIBHACKRF_INCLUDE_DIR)
|
||||
|
@ -21,9 +21,6 @@
|
||||
|
||||
# Based heavily upon the libftdi cmake setup.
|
||||
|
||||
option(EXAMPLES "Build example programs" ON)
|
||||
|
||||
IF( EXAMPLES )
|
||||
add_executable(hackrf_max2837 hackrf_max2837.c)
|
||||
add_executable(hackrf_si5351c hackrf_si5351c.c)
|
||||
add_executable(hackrf_transfer hackrf_transfer.c)
|
||||
@ -32,13 +29,14 @@ IF( EXAMPLES )
|
||||
add_executable(hackrf_cpldjtag hackrf_cpldjtag.c)
|
||||
add_executable(hackrf_info hackrf_info.c)
|
||||
|
||||
target_link_libraries(hackrf_max2837 hackrf)
|
||||
target_link_libraries(hackrf_si5351c hackrf)
|
||||
target_link_libraries(hackrf_transfer hackrf)
|
||||
target_link_libraries(hackrf_rffc5071 hackrf)
|
||||
target_link_libraries(hackrf_spiflash hackrf)
|
||||
target_link_libraries(hackrf_cpldjtag hackrf)
|
||||
target_link_libraries(hackrf_info hackrf)
|
||||
include_directories(${LIBHACKRF_INCLUDE_DIR})
|
||||
|
||||
target_link_libraries(hackrf_max2837 ${LIBHACKRF_LIBRARIES})
|
||||
target_link_libraries(hackrf_si5351c ${LIBHACKRF_LIBRARIES})
|
||||
target_link_libraries(hackrf_transfer ${LIBHACKRF_LIBRARIES})
|
||||
target_link_libraries(hackrf_rffc5071 ${LIBHACKRF_LIBRARIES})
|
||||
target_link_libraries(hackrf_spiflash ${LIBHACKRF_LIBRARIES})
|
||||
target_link_libraries(hackrf_cpldjtag ${LIBHACKRF_LIBRARIES})
|
||||
target_link_libraries(hackrf_info ${LIBHACKRF_LIBRARIES})
|
||||
|
||||
|
||||
include_directories(BEFORE ${CMAKE_SOURCE_DIR}/../libhackrf/src)
|
||||
endif(EXAMPLES)
|
||||
|
Reference in New Issue
Block a user