-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes a bug where includes are not visible to parent projects when rs_driver is submoduled. #9
base: release
Are you sure you want to change the base?
Conversation
…library otherwise the includes will not propagate to a parent project, interface library is a fake library since this is a header only project, also change the params to public as these are very useful to end users when inspecting packets
Hi stephend, we have test as when release last version and it work. So could you give us some information to test about it?
as for the thank for your issue~~ |
Hi Hao, include_directories(${rs_driver_INCLUDE_DIRS}) ONLY includes rs_drivers include directories and not it's dependencies, i.e., Boost, PCAP. Cloning your project as a submodule and then including 3.2 in CMakeLists.txt causes cmake to fail to find the boost and pcap header files. This is because your project doesn't add the dependencies as target_includes. Setting your project as interface with the target_includes and then things work in other projects. Parent CMakeLists.txt: project(m1) set(CMAKE_CXX_STANDARD 14) add_executable(parse_to_csv parse_to_csv.cpp) add_subdirectory(rs_driver) Notice the addition of target_link_libraries pointed at your project which pulls in the dependency headers. Well I'm an end user and I'm using these params :) The params are convenient for end user because it has information about the different lidar models for the end users programs. MSOP_ID is useful for packet recognition, and things like LASER_NUM and CHANNELS_PER_BLOCK are useful for users own parsing code. |
I have a discussion about this with my partners, and here is our opinion
Thanks for your suggestion again, must be a very careful person |
Thanks for the response Hao. I think there is a misunderstanding behind what the INTERFACE tag does and why ALL header only CMake projects have it. End user is still able to use a different version of Boost and Eigen with this setup. In fact Eigen/Boost are not marked in your CMakeLists.txt with a specified version. For example I am using latest Boost and Eigen which were already installed before trying out the rs_drivers. Typically you would want to set a minimum version, surprised this was missing. It is industry practice to declare your header only library an INTERFACE in CMake. I would implore you to check out ANY popular header only library: The point of that line is to specify rs_drivers project dependencies. Right now your target is effectively missing it's dependencies which is incorrect. Hope you found that helpful! |
Hi all, I have implemented Stephen's commit and the problem is still present. It is clear from the output that the test.cpp file isn't getting the dependencies it needs. Any help is greatly appreciated. I have been banging my head on this for 3 days. |
Fixed your code so it at least compiles now, you forgot your test.txt is a txt because github doesn't let you add .cpp so make sure to change extension back ;) |
Hi kvern, in your case, it seem to have 2 BUGs
the second one is similar with Stephen |
Sorry Stephen, I seem to have misunderstood you. rs_driver's current cmake is traditional cmake, There are docs to change and more test to do when change to modern cmake, we are trying to fix the traditional one and change to modern in next release. |
Hi Stephen, a fix has been push to main branch, I have test it with kvern's code in VS2017 and it has solved the include problem. Could you please test the main branch in your environment? We will try to change to modern cmake in next release as you suggested Thanks! |
Yes, that does fix the include issue for me. However, that branch still had Cheers! |
Hi all, This is my first C++ project for work, looking forward to development! |
Howdy, couple line change to fix a bug with sub-moduling this library.
add_library(rs_driver INTERFACE)
makes the project a header only library so thattarget_include_directories
properly get forwarded to parent projects. Without this parent projects will fail to find the headers when used as submodules (particularly useful for windows users).Also changed the lidar params from private to public as these are very useful to get param settings for user.