Previously, I had been grabbing concurrentqueue with cmake's FetchContent and it worked great. Recently, I switched to using it as a bitbake recipe in an embedded system, where concurrentqueue gets installed as a system-level dependency. I suddenly had to change my includes to #include <moodycamel/concurrentqueue.h>. And of course this fails when I want to build without the system-level install for local debugging without the embedded sysroot.
I think the problem is simple:
|
target_include_directories(${PROJECT_NAME} |
|
INTERFACE |
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> |
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/> |
|
) |
and
|
install( |
|
FILES |
|
blockingconcurrentqueue.h |
|
concurrentqueue.h |
|
lightweightsemaphore.h |
|
LICENSE.md |
|
DESTINATION |
|
${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/moodycamel |
|
) |
should match.
I propose removing the trailing moodycamel from the install destination.
That way, all the include statements in the source code will be the same (#include <concurrentqueue.h>) whether someone grabs concurrentqueue with FetchContent or they install concurrentqueue to the system and use find_package(concurrentqueue) followed by target_link_libraries(${PROJECT_NAME} concurrentqueue::concurrentqueue).
Currently, I'm patching concurrentqueue on fetch with this exact change and it's working well for me.
Previously, I had been grabbing concurrentqueue with cmake's
FetchContentand it worked great. Recently, I switched to using it as a bitbake recipe in an embedded system, where concurrentqueue gets installed as a system-level dependency. I suddenly had to change my includes to#include <moodycamel/concurrentqueue.h>. And of course this fails when I want to build without the system-level install for local debugging without the embedded sysroot.I think the problem is simple:
concurrentqueue/CMakeLists.txt
Lines 9 to 13 in 189e381
and
concurrentqueue/CMakeLists.txt
Lines 54 to 62 in 189e381
should match.
I propose removing the trailing
moodycamelfrom the install destination.That way, all the include statements in the source code will be the same (
#include <concurrentqueue.h>) whether someone grabs concurrentqueue with FetchContent or they install concurrentqueue to the system and usefind_package(concurrentqueue)followed bytarget_link_libraries(${PROJECT_NAME} concurrentqueue::concurrentqueue).Currently, I'm patching concurrentqueue on fetch with this exact change and it's working well for me.