Skip to content

Do not apply include_guards to the entire build through the GLOBAL flag. #74

@davidlion

Description

@davidlion

Bug

Generally find_package is supposed to find a package and make it available in the current scope by default. If you call find_package from two different scopes that are independent they should both succeed.

Currently, ystdlib uses include_guard(GLOBAL) forcing CMake to elevate the guard to the global scope and preventing multiple find_package calls from different scopes to succeed. Using include_guard() (without the GLOBAL flag) instead acts as an include guard in the current scope, meaning that it should prevent re-invocation in nested scopes, but won't prevent re-invocation in other independent scopes.

It is possible to have a find_package call expose the package globally with a flag, but that is unrelated to the issue.

ystdlib-cpp version

9ed78cd

Environment

CLP container, but should be reproducible on any environment.

Reproduction steps

  1. Create a project calling find_package(ystdlib REQUIRED) from multiple scopes.
  2. Run cmake generation/configuration step.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions