Skip to content

Overriding CMAKE_INSTALL_PREFIX is bad practice #12

Closed
@patbrandt

Description

@patbrandt

SET(CMAKE_INSTALL_PREFIX ${FMILIB_INSTALL_PREFIX} CACHE INTERNAL "Prefix prepended to install directories" FORCE)

Though calling it "practice" implies that I've ever seen it done elsewhere. This is silently and forcibly(!) setting a core cmake option to something other than what the user might specify, which is not great. In isolation to one project (this one), it's... probably fine? When building code with/against FMILibrary it blows up.

We are attempting to use FMILibrary as a sub-project, and this line nukes the install path for the rest of our code, unless we set the FMI-specific install path to the same one. Which, to be fair, we probably would, but it's a pit that we easily fell into.

My recommendation would be to simply use CMAKE_INSTALL_PREFIX natively, but at the very least don't override user settings for standard cmake variables.

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