1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-15 03:48:02 +08:00

Makefiles: Explicitly tell 'make' tool what Makefile name to use

CMake did not specify the filename of the Makefile generated by it.
Due to GNU make precedence rules this means that the presence of a
GNUmakefile or makefile would take precedence over the generated
Makefile.

This is only relevant for in-source builds and only whenever an
alternative makefile by the above mentioned names exists.

This patch adds the (seemingly universal) `-f` switch and the
(hardcoded) filename (it is now hardcoded separately in these two
files):

- cmLocalUnixMakefileGenerator3.cxx
- cmGlobalUnixMakefileGenerator3.cxx

Fixes: #21418
This commit is contained in:
Oliver Schneider
2020-11-13 22:27:45 +01:00
committed by Brad King
parent 01b473b810
commit 378c047ae3

View File

@@ -589,6 +589,11 @@ cmGlobalUnixMakefileGenerator3::GenerateBuildCommand(
}
makeCommand.Add(this->SelectMakeProgram(makeProgram));
// Explicitly tell the make tool to use the Makefile written by
// cmLocalUnixMakefileGenerator3::WriteLocalMakefile
makeCommand.Add("-f");
makeCommand.Add("Makefile");
if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) {
if (jobs == cmake::DEFAULT_BUILD_PARALLEL_LEVEL) {
makeCommand.Add("-j");