Skip to content

Consider reviewing the include path for a CMake install #391

Description

@fedapo

The CMake-based build+install works, but it ends up installing the header files in include/concurrentqueue/moodycamel. This forces client code to use this header inclusion:

#include <concurrentqueue/moodycamel/blockingconcurrentqueue.h>

While it would be preferable a simpler path, as this.

#include <concurrentqueue/blockingconcurrentqueue.h>

This is also the path taken by the concurrentqueue installation through Vcpkg and it is in the best interest for the spreading of the library that the two approaches are exactly the same.
The line responsible for this, and the only one that should need to be changed is the following.

${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/moodycamel

Changed to this.

    ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}

I could take care of the change, but I need to understand there's agreement on it.
Will this change find acceptance?

NOTE:
Should it be critical to keep the word moodycamel in the path I'd suggest a more intuitive path.

#include <moodycamel/concurrentqueue/blockingconcurrentqueue.h>

The name of the organization (moodycamel) has a broader scope than the name of the library (concurrentqueue), it feel really weird that the two are inverted.

Activity

  1. lixin-wei commented on Sep 18, 2025

    @lixin-wei

    I finally wrote this in my project...

    #if __has_include(<blockingconcurrentqueue.h>)
        #include <blockingconcurrentqueue.h>
    #elif __has_include(<moodycamel/blockingconcurrentqueue.h>)
        #include <moodycamel/blockingconcurrentqueue.h>
    #else
        #include <concurrentqueue/moodycamel/blockingconcurrentqueue.h>
    #endif
  2. fedapo commented on Sep 18, 2025

    @fedapo
    Author

    I finally wrote this in my project...

    #if __has_include(<blockingconcurrentqueue.h>)
    #include <blockingconcurrentqueue.h>
    #elif __has_include(<moodycamel/blockingconcurrentqueue.h>)
    #include <moodycamel/blockingconcurrentqueue.h>
    #else
    #include <concurrentqueue/moodycamel/blockingconcurrentqueue.h>
    #endif

    Yes, eventually one needs to bite the bullet and resort to having the client code adjust. I seem to remember that the library in Vcpkg uses yet another header path, concurrentqueue/blockingconcurrentqueue.h, which is the most sensible one (following the easy-to-guess pattern <library_name>/<header_file_name>). You might check and add it to your trick.

  3. lixin-wei commented on Sep 18, 2025

    @lixin-wei

    OK, thx, 4 branches now😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions