Skip to content

Using Crow from a top-level CMakeLists.txt #1057

@anthony-loiseau-act

Description

@anthony-loiseau-act

I am including Crow from a CMakeLists.txt and get different results depending on where my project CMakeLists.txt is in my repository.

  • If I include Crow from /CmakeList.txt in my repository, then Crow CMakeList.txt triggers CROW_IS_MAIN_PROJECT. It then enables examples which crashes on cmake/compiler_options.cmake not found because searched in my repo root.
  • If I move my CmakeList.txt in a subfolder of my repo, then Crow CMakeList.txt do not triggers CROW_IS_MAIN_PROJECT, therefore do not enable examples and things go well, I can use the library.

I guess I am missing something, but I did not see a kind of CROW_IS_MAIN_PROJECT override I could have set in my project to enforce library to not detect itself as the main project.

I include Crow using FetchContent, this way:

include(FetchContent)
FetchContent_Declare(
  crow
  GIT_REPOSITORY https://github.com/CrowCpp/Crow.git
  GIT_TAG v1.2.1.2)
FetchContent_MakeAvailable(crow)

Is there any advises to workaround this?
Do you think this is a misuse of mine or an issue of the library?

(to be more accurate, I use Crow in a /foo/CMakeList.txt but I have a /CMakeList.txt which let me build all foo bar and baz apps at once by including all CMakeList.txt folders. I can build foo alone but top-level CMakeList.txt fails to build it)

Regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionThe viability / implementation of the issue is up for debate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions