Skip to content

Build issue: let user decide the MASTER_PROJECT variable #2098

Closed
@randomizedthinking

Description

@randomizedthinking

This is a small question on building the fmt library. In my use case, fmt is included as a git submodule, and I would like to build and install fmt automatically along with the main project. Yet, the current fmt CMakefile would not allow me to do it because the MASTER_PROJECT variable in CMakeLists.txt is determined in the build time.

The solution would be straightforward: define a FMT_MASTER_PROJECT and check whether it is defined before setting it up. If you think it is worthwhile to have, I can submit a PR.

if(NOT DEFINED FMT_MASTER_PROJECT)
    if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
        set(FMT_MASTER_PROJECT ON)
    else()
        set(FMT_MASTER_PROJECT OFF)
    endif()
endif()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions