Open ferdymercury opened 2 years ago
Ok, I managed the following, using https://github.com/ferdymercury/cmake-modules/blob/main/FindModbus.cmake:
find_package(Modbus REQUIRED)
set (modbuspp_DIR "/usr/local/lib/modbuspp/cmake/" CACHE STRING "modbuspp cmake folder")
find_package(modbuspp REQUIRED)
add_executable(foo foo.cpp)
target_compile_options(foo PRIVATE)
target_include_directories(foo PRIVATE ${MODBUS_INCLUDE_DIR} ${MODBUSPP_INCLUDE_DIRS})
target_link_libraries(foo PUBLIC ${MODBUSPP_LIBRARIES})
add_test(
NAME foo
COMMAND foo ?
)
I think it would be nicer if the CMake file would automatically define the interface_directories and libraries to include, instead of having to apply those manually in your targets.
Hello, thanks for the repository!
Is there a clean way to include it from other projects, using
find_package(Modbus)
or something similar, instead of hard-coding the paths? (I installed it using apt)If yes, could this info be added to the README ?