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

Merge topic 'cmake-build-specify-makefile-name'

cfce067b3f Tests: Add RunCMake.Make case for conflicting Makefile names
378c047ae3 Makefiles: Explicitly tell 'make' tool what Makefile name to use

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5509
This commit is contained in:
Brad King
2020-11-17 18:13:57 +00:00
committed by Kitware Robot
3 changed files with 18 additions and 0 deletions

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");

View File

@@ -0,0 +1,5 @@
add_custom_target(Custom)
# Write a file that GNU make will prefer over "Makefile"
# if 'cmake --build' does not explicitly specify it.
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/GNUmakefile" "")

View File

@@ -42,6 +42,14 @@ run_VerboseBuild()
run_cmake(CustomCommandDepfile-ERROR)
run_cmake(IncludeRegexSubdir)
function(run_MakefileConflict)
run_cmake(MakefileConflict)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/MakefileConflict-build)
run_cmake_command(MakefileConflict-build ${CMAKE_COMMAND} --build . --target Custom)
endfunction()
run_MakefileConflict()
function(run_CMP0113 val)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0113-${val}-build)
run_cmake(CMP0113-${val})