Skip to content

Fix make install failing after CMAKE_INSTALL_PREFIX is changed#708

Open
pvutov wants to merge 2 commits into
microsoft:masterfrom
pvutov:master
Open

Fix make install failing after CMAKE_INSTALL_PREFIX is changed#708
pvutov wants to merge 2 commits into
microsoft:masterfrom
pvutov:master

Conversation

@pvutov
Copy link
Copy Markdown

@pvutov pvutov commented May 15, 2026

The zlib subproject is setting several unnecessary cache variables: INSTALL_BIN_DIR etc. The values for these variables are only derived once, during the initial configuration, from CMAKE_INSTALL_PREFIX.

The specific bug this causes is:

cmake -DCMAKE_INSTALL_PREFIX=/tmp/install1 ..
make install # works
cmake --install . --prefix /tmp/install2  # does not do what we'd expect, because INSTALL_BIN_DIR is not properly updated

The first commit on my fork merely fixes the bug. The second commit also fixes an IMO bad design decision by removing the unnecessary cache variables involved in the bug.

Petar Vutov added 2 commits May 15, 2026 12:13
zlib is using absolute paths with the install command, which is bad
practice. Installation paths should be relative, allowing cmake to
resolve them relative to CMAKE_INSTALL_PREFIX.
CMake is not a generic programming language. Unnecessary variables
should be avoided. For example, if a variable name is misspelled,
cmake will happily resolve it to an empty string.

In addition, unnecessary cache variables make it difficult for users to
configure the project (tyranny of choice). Cache variables should be
limited to things that a user might reasonably want to customize.

It makes no sense to offer installing libs to a place other than "lib",
or binaries to a place other than "bin". "make install" is supposed to
provide a standard install structure.
@pvutov
Copy link
Copy Markdown
Author

pvutov commented May 15, 2026

@microsoft-github-policy-service agree company="RUAG AG"

@pvutov
Copy link
Copy Markdown
Author

pvutov commented May 15, 2026

I am noticing that this project more generally does not support installing; the main msix-packaging binary and lib do not show up in the install folder even with my fix. But that can be fixed separately by adding an install( command to src/makemsix/CMakeLists.txt 😅

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant