diff --git a/libuavcan/dsdl_compiler/libuavcan_dsdlc b/libuavcan/dsdl_compiler/libuavcan_dsdlc index 5b47830260..6032c1eaa7 100755 --- a/libuavcan/dsdl_compiler/libuavcan_dsdlc +++ b/libuavcan/dsdl_compiler/libuavcan_dsdlc @@ -7,7 +7,7 @@ import os, sys, logging, argparse -RUNNING_FROM_SRC_DIR = os.path.abspath(__file__).endswith(os.path.join('libuavcan', 'dsdl_compiler', 'uavcan_dsdlc')) +RUNNING_FROM_SRC_DIR = os.path.abspath(__file__).endswith(os.path.join('libuavcan', 'dsdl_compiler', 'libuavcan_dsdlc')) if RUNNING_FROM_SRC_DIR: print('Running from the source directory') scriptdir = os.path.dirname(os.path.abspath(__file__)) diff --git a/libuavcan_drivers/linux/CMakeLists.txt b/libuavcan_drivers/linux/CMakeLists.txt index ba115a62ed..dd97f9a0c7 100644 --- a/libuavcan_drivers/linux/CMakeLists.txt +++ b/libuavcan_drivers/linux/CMakeLists.txt @@ -11,10 +11,23 @@ project(libuavcan_linux) # install(DIRECTORY include/uavcan_linux DESTINATION include) +# +# Finding libuavcan - it will be a target if we're running from the top-level CMakeLists.txt, +# otherwise try to find it in the system directories. +# +if (TARGET uavcan) + message(STATUS "Using uavcan target; source dir: ${libuavcan_SOURCE_DIR}") + set(UAVCAN_LIB uavcan) + include_directories(${libuavcan_SOURCE_DIR}/include + ${libuavcan_SOURCE_DIR}/include/dsdlc_generated) +else () + message(STATUS "Using installed uavcan library") + find_library(UAVCAN_LIB uavcan REQUIRED) +endif () + # # Test/demo executables # -find_library(UAVCAN_LIB uavcan REQUIRED) include_directories(include) set(CMAKE_CXX_FLAGS "-Wall -Wextra -Werror -pedantic -std=c++0x -g3") # GCC or Clang