Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
CMake
CMake
Commits
324d18bb
Commit
324d18bb
authored
Feb 08, 2019
by
Bartosz Kosiorek
Committed by
Brad King
Mar 05, 2019
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmake: Teach --build mode to support multiple targets
Fixes:
#16136
parent
ebc94500
Changes
35
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
403 additions
and
325 deletions
+403
-325
Help/command/build_command.rst
Help/command/build_command.rst
+1
-1
Help/manual/cmake.1.rst
Help/manual/cmake.1.rst
+2
-2
Help/release/dev/cmake-build-multiply-targets.rst
Help/release/dev/cmake-build-multiply-targets.rst
+5
-0
Source/CTest/cmCTestBuildAndTestHandler.cxx
Source/CTest/cmCTestBuildAndTestHandler.cxx
+1
-1
Source/cmGlobalBorlandMakefileGenerator.cxx
Source/cmGlobalBorlandMakefileGenerator.cxx
+9
-8
Source/cmGlobalBorlandMakefileGenerator.h
Source/cmGlobalBorlandMakefileGenerator.h
+6
-9
Source/cmGlobalGenerator.cxx
Source/cmGlobalGenerator.cxx
+56
-43
Source/cmGlobalGenerator.h
Source/cmGlobalGenerator.h
+9
-9
Source/cmGlobalGhsMultiGenerator.cxx
Source/cmGlobalGhsMultiGenerator.cxx
+19
-11
Source/cmGlobalGhsMultiGenerator.h
Source/cmGlobalGhsMultiGenerator.h
+6
-9
Source/cmGlobalJOMMakefileGenerator.cxx
Source/cmGlobalJOMMakefileGenerator.cxx
+9
-8
Source/cmGlobalJOMMakefileGenerator.h
Source/cmGlobalJOMMakefileGenerator.h
+6
-9
Source/cmGlobalNMakeMakefileGenerator.cxx
Source/cmGlobalNMakeMakefileGenerator.cxx
+9
-8
Source/cmGlobalNMakeMakefileGenerator.h
Source/cmGlobalNMakeMakefileGenerator.h
+6
-9
Source/cmGlobalNinjaGenerator.cxx
Source/cmGlobalNinjaGenerator.cxx
+17
-11
Source/cmGlobalNinjaGenerator.h
Source/cmGlobalNinjaGenerator.h
+6
-9
Source/cmGlobalUnixMakefileGenerator3.cxx
Source/cmGlobalUnixMakefileGenerator3.cxx
+20
-14
Source/cmGlobalUnixMakefileGenerator3.h
Source/cmGlobalUnixMakefileGenerator3.h
+6
-9
Source/cmGlobalVisualStudio10Generator.cxx
Source/cmGlobalVisualStudio10Generator.cxx
+66
-55
Source/cmGlobalVisualStudio10Generator.h
Source/cmGlobalVisualStudio10Generator.h
+6
-9
Source/cmGlobalVisualStudio7Generator.cxx
Source/cmGlobalVisualStudio7Generator.cxx
+38
-20
Source/cmGlobalVisualStudio7Generator.h
Source/cmGlobalVisualStudio7Generator.h
+6
-9
Source/cmGlobalWatcomWMakeGenerator.cxx
Source/cmGlobalWatcomWMakeGenerator.cxx
+10
-8
Source/cmGlobalWatcomWMakeGenerator.h
Source/cmGlobalWatcomWMakeGenerator.h
+6
-9
Source/cmGlobalXCodeGenerator.cxx
Source/cmGlobalXCodeGenerator.cxx
+26
-14
Source/cmGlobalXCodeGenerator.h
Source/cmGlobalXCodeGenerator.h
+6
-9
Source/cmake.cxx
Source/cmake.cxx
+4
-4
Source/cmake.h
Source/cmake.h
+2
-2
Source/cmakemain.cxx
Source/cmakemain.cxx
+28
-16
Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-jobs-stderr.txt
...mandLine/BuildDir--build-multiple-targets-jobs-stderr.txt
+1
-0
Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-with-clean-first-result.txt
...ldDir--build-multiple-targets-with-clean-first-result.txt
+0
-0
Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-with-clean-first-stderr.txt
...ldDir--build-multiple-targets-with-clean-first-stderr.txt
+2
-0
Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-with-clean-second-result.txt
...dDir--build-multiple-targets-with-clean-second-result.txt
+1
-0
Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-with-clean-second-stderr.txt
...dDir--build-multiple-targets-with-clean-second-stderr.txt
+2
-0
Tests/RunCMake/CommandLine/RunCMakeTest.cmake
Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+6
-0
No files found.
Help/command/build_command.rst
View file @
324d18bb
...
...
@@ -14,7 +14,7 @@ This is mainly intended for internal use by the :module:`CTest` module.
Sets the given ``<variable>`` to a command-line string of the form::
<cmake> --build . [--config <config>] [--target <target>] [-- -i]
<cmake> --build . [--config <config>] [--target <target>
...
] [-- -i]
where ``<cmake>`` is the location of the :manual:`cmake(1)` command-line
tool, and ``<config>`` and ``<target>`` are the values provided to the
...
...
Help/manual/cmake.1.rst
View file @
324d18bb
...
...
@@ -276,8 +276,8 @@ following options:
The :envvar:`CMAKE_BUILD_PARALLEL_LEVEL` environment variable, if set,
specifies a default parallel level when this option is not given.
``--target <tgt>``
Build ``<tgt>`` instead of default targets. May
only
be specified
once
.
``--target <tgt>
...
``
Build ``<tgt>`` instead of default targets. May be specified
multiple times
.
``--config <cfg>``
For multi-configuration tools, choose configuration ``<cfg>``.
...
...
Help/release/dev/cmake-build-multiply-targets.rst
0 → 100644
View file @
324d18bb
cmake-build-multiply-targets
----------------------------
* The :manual:`cmake(1)` ``--build`` tool ``--target`` parameter gained support for
multiple targets, e.g. ``cmake --build . --target Library1 Library2``.
Source/CTest/cmCTestBuildAndTestHandler.cxx
View file @
324d18bb
...
...
@@ -256,7 +256,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
}
int
retVal
=
cm
.
GetGlobalGenerator
()
->
Build
(
cmake
::
NO_BUILD_PARALLEL_LEVEL
,
this
->
SourceDir
,
this
->
BinaryDir
,
this
->
BuildProject
,
tar
,
output
,
this
->
BuildMakeProgram
,
config
,
this
->
BuildProject
,
{
tar
}
,
output
,
this
->
BuildMakeProgram
,
config
,
!
this
->
BuildNoClean
,
false
,
false
,
remainingTime
);
out
<<
output
;
// if the build failed then return
...
...
Source/cmGlobalBorlandMakefileGenerator.cxx
View file @
324d18bb
...
...
@@ -53,15 +53,16 @@ void cmGlobalBorlandMakefileGenerator::GetDocumentation(
entry
.
Brief
=
"Generates Borland makefiles."
;
}
void
cmGlobalBorlandMakefileGenerator
::
GenerateBuildCommand
(
GeneratedMakeCommand
&
makeCommand
,
const
std
::
string
&
makeProgram
,
const
std
::
string
&
projectName
,
const
std
::
string
&
projectDir
,
const
std
::
string
&
targetName
,
const
std
::
string
&
config
,
bool
fast
,
int
/*jobs*/
,
bool
verbose
,
std
::
vector
<
std
::
string
>
const
&
makeOptions
)
std
::
vector
<
cmGlobalGenerator
::
GeneratedMakeCommand
>
cmGlobalBorlandMakefileGenerator
::
GenerateBuildCommand
(
const
std
::
string
&
makeProgram
,
const
std
::
string
&
projectName
,
const
std
::
string
&
projectDir
,
std
::
vector
<
std
::
string
>
const
&
targetNames
,
const
std
::
string
&
config
,
bool
fast
,
int
/*jobs*/
,
bool
verbose
,
std
::
vector
<
std
::
string
>
const
&
makeOptions
)
{
this
->
cmGlobalUnixMakefileGenerator3
::
GenerateBuildCommand
(
makeCommand
,
makeProgram
,
projectName
,
projectDir
,
targetName
,
config
,
fast
,
cmake
::
NO_BUILD_PARALLEL_LEVEL
,
verbose
,
makeOptions
);
return
this
->
cmGlobalUnixMakefileGenerator3
::
GenerateBuildCommand
(
makeProgram
,
projectName
,
projectDir
,
targetName
s
,
config
,
fast
,
cmake
::
NO_BUILD_PARALLEL_LEVEL
,
verbose
,
makeOptions
);
}
void
cmGlobalBorlandMakefileGenerator
::
PrintBuildCommandAdvice
(
...
...
Source/cmGlobalBorlandMakefileGenerator.h
View file @
324d18bb
...
...
@@ -46,15 +46,12 @@ public:
bool
AllowDeleteOnError
()
const
override
{
return
false
;
}
protected:
void
GenerateBuildCommand
(
GeneratedMakeCommand
&
makeCommand
,
const
std
::
string
&
makeProgram
,
const
std
::
string
&
projectName
,
const
std
::
string
&
projectDir
,
const
std
::
string
&
targetName
,
const
std
::
string
&
config
,
bool
fast
,
int
jobs
,
bool
verbose
,
std
::
vector
<
std
::
string
>
const
&
makeOptions
=
std
::
vector
<
std
::
string
>
())
override
;
std
::
vector
<
GeneratedMakeCommand
>
GenerateBuildCommand
(
const
std
::
string
&
makeProgram
,
const
std
::
string
&
projectName
,
const
std
::
string
&
projectDir
,
std
::
vector
<
std
::
string
>
const
&
targetNames
,
const
std
::
string
&
config
,
bool
fast
,
int
jobs
,
bool
verbose
,
std
::
vector
<
std
::
string
>
const
&
makeOptions
=
std
::
vector
<
std
::
string
>
())
override
;
void
PrintBuildCommandAdvice
(
std
::
ostream
&
os
,
int
jobs
)
const
override
;
};
...
...
Source/cmGlobalGenerator.cxx
View file @
324d18bb
...
...
@@ -1763,9 +1763,9 @@ int cmGlobalGenerator::TryCompile(int jobs, const std::string& srcdir,
this
->
FirstTimeProgress
);
}
std
::
string
newTarget
;
std
::
vector
<
std
::
string
>
newTarget
=
{}
;
if
(
!
target
.
empty
())
{
newTarget
+
=
target
;
newTarget
=
{
target
}
;
}
std
::
string
config
=
mf
->
GetSafeDefinition
(
"CMAKE_TRY_COMPILE_CONFIGURATION"
);
...
...
@@ -1773,14 +1773,16 @@ int cmGlobalGenerator::TryCompile(int jobs, const std::string& srcdir,
config
,
false
,
fast
,
false
,
this
->
TryCompileTimeout
);
}
void
cmGlobalGenerator
::
Generate
Build
Command
(
GeneratedMakeCommand
&
makeCommand
,
const
std
::
string
&
/*unused*/
,
std
::
vector
<
cmGlobalGenerator
::
Generate
dMake
Command
>
cmGlobalGenerator
::
GenerateBuildCommand
(
const
std
::
string
&
/*unused*/
,
const
std
::
string
&
/*unused*/
,
const
std
::
string
&
/*unused*/
,
const
std
::
string
&
/*unused*/
,
bool
/*unused*/
,
int
/*unused*/
,
bool
/*unused*/
,
std
::
vector
<
std
::
string
>
const
&
/*unused*/
)
const
std
::
string
&
/*unused*/
,
std
::
vector
<
std
::
string
>
const
&
/*unused*/
,
const
std
::
string
&
/*unused*/
,
bool
/*unused*/
,
int
/*unused*/
,
bool
/*unused*/
,
std
::
vector
<
std
::
string
>
const
&
/*unused*/
)
{
GeneratedMakeCommand
makeCommand
;
makeCommand
.
Add
(
"cmGlobalGenerator::GenerateBuildCommand not implemented"
);
return
{
std
::
move
(
makeCommand
)
};
}
void
cmGlobalGenerator
::
PrintBuildCommandAdvice
(
std
::
ostream
&
/*os*/
,
...
...
@@ -1790,15 +1792,13 @@ void cmGlobalGenerator::PrintBuildCommandAdvice(std::ostream& /*os*/,
// they do not support certain build command line options
}
int
cmGlobalGenerator
::
Build
(
int
jobs
,
const
std
::
string
&
/*unused*/
,
const
std
::
string
&
bindir
,
const
std
::
string
&
projectName
,
const
std
::
string
&
target
,
std
::
string
&
output
,
const
std
::
string
&
makeCommandCSTR
,
const
std
::
string
&
config
,
bool
clean
,
bool
fast
,
bool
verbose
,
cmDuration
timeout
,
cmSystemTools
::
OutputOption
outputflag
,
std
::
vector
<
std
::
string
>
const
&
nativeOptions
)
int
cmGlobalGenerator
::
Build
(
int
jobs
,
const
std
::
string
&
/*unused*/
,
const
std
::
string
&
bindir
,
const
std
::
string
&
projectName
,
const
std
::
vector
<
std
::
string
>&
targets
,
std
::
string
&
output
,
const
std
::
string
&
makeCommandCSTR
,
const
std
::
string
&
config
,
bool
clean
,
bool
fast
,
bool
verbose
,
cmDuration
timeout
,
cmSystemTools
::
OutputOption
outputflag
,
std
::
vector
<
std
::
string
>
const
&
nativeOptions
)
{
bool
hideconsole
=
cmSystemTools
::
GetRunCommandHideConsole
();
...
...
@@ -1819,32 +1819,37 @@ int cmGlobalGenerator::Build(int jobs, const std::string& /*unused*/,
return
1
;
}
int
retVal
;
int
retVal
=
0
;
cmSystemTools
::
SetRunCommandHideConsole
(
true
);
std
::
string
outputBuffer
;
std
::
string
*
outputPtr
=
&
outputBuffer
;
GeneratedMakeCommand
makeCommand
;
this
->
GenerateBuildCommand
(
makeCommand
,
makeCommandCSTR
,
projectName
,
bindir
,
target
,
config
,
fast
,
jobs
,
verbose
,
nativeOptions
);
std
::
vector
<
GeneratedMakeCommand
>
makeCommand
=
this
->
GenerateBuildCommand
(
makeCommandCSTR
,
projectName
,
bindir
,
targets
,
config
,
fast
,
jobs
,
verbose
,
nativeOptions
);
// Workaround to convince some commands to produce output.
if
(
outputflag
==
cmSystemTools
::
OUTPUT_PASSTHROUGH
&&
makeCommand
.
RequiresOutputForward
)
{
makeCommand
.
back
().
RequiresOutputForward
)
{
outputflag
=
cmSystemTools
::
OUTPUT_FORWARD
;
}
// should we do a clean first?
if
(
clean
)
{
GeneratedMakeCommand
cleanCommand
;
this
->
GenerateBuildCommand
(
cleanCommand
,
makeCommandCSTR
,
projectName
,
bindir
,
"clean"
,
config
,
fast
,
jobs
,
verbose
);
std
::
vector
<
GeneratedMakeCommand
>
cleanCommand
=
this
->
GenerateBuildCommand
(
makeCommandCSTR
,
projectName
,
bindir
,
{
"clean"
}
,
config
,
fast
,
jobs
,
verbose
);
output
+=
"
\n
Run Clean Command:"
;
output
+=
cleanCommand
.
Printable
();
output
+=
cleanCommand
.
front
().
Printable
();
output
+=
"
\n
"
;
if
(
!
cmSystemTools
::
RunSingleCommand
(
cleanCommand
.
PrimaryCommand
,
if
(
cleanCommand
.
size
()
!=
1
)
{
this
->
GetCMakeInstance
()
->
IssueMessage
(
MessageType
::
INTERNAL_ERROR
,
"The generator did not produce "
"exactly one command for the "
"'clean' target"
);
return
1
;
}
if
(
!
cmSystemTools
::
RunSingleCommand
(
cleanCommand
.
front
().
PrimaryCommand
,
outputPtr
,
outputPtr
,
&
retVal
,
nullptr
,
outputflag
,
timeout
))
{
cmSystemTools
::
SetRunCommandHideConsole
(
hideconsole
);
...
...
@@ -1858,25 +1863,33 @@ int cmGlobalGenerator::Build(int jobs, const std::string& /*unused*/,
}
// now build
std
::
string
makeCommandStr
=
makeCommand
.
Printable
()
;
std
::
string
makeCommandStr
;
output
+=
"
\n
Run Build Command(s):"
;
output
+=
makeCommandStr
;
output
+=
"
\n
"
;
if
(
!
cmSystemTools
::
RunSingleCommand
(
makeCommand
.
PrimaryCommand
,
outputPtr
,
outputPtr
,
&
retVal
,
nullptr
,
outputflag
,
timeout
))
{
cmSystemTools
::
SetRunCommandHideConsole
(
hideconsole
);
cmSystemTools
::
Error
(
"Generator: execution of make failed. Make command was: "
+
makeCommandStr
);
output
+=
*
outputPtr
;
output
+=
"
\n
Generator: execution of make failed. Make command was: "
+
makeCommandStr
+
"
\n
"
;
for
(
auto
command
=
makeCommand
.
begin
();
command
!=
makeCommand
.
end
();
++
command
)
{
makeCommandStr
=
command
->
Printable
();
if
(
command
!=
makeCommand
.
end
())
{
makeCommandStr
+=
" && "
;
}
return
1
;
output
+=
makeCommandStr
;
if
(
!
cmSystemTools
::
RunSingleCommand
(
command
->
PrimaryCommand
,
outputPtr
,
outputPtr
,
&
retVal
,
nullptr
,
outputflag
,
timeout
))
{
cmSystemTools
::
SetRunCommandHideConsole
(
hideconsole
);
cmSystemTools
::
Error
(
"Generator: execution of make failed. Make command was: "
+
makeCommandStr
);
output
+=
*
outputPtr
;
output
+=
"
\n
Generator: execution of make failed. Make command was: "
+
makeCommandStr
+
"
\n
"
;
return
1
;
}
output
+=
*
outputPtr
;
}
output
+=
*
outputPtr
;
output
+=
"
\n
"
;
cmSystemTools
::
SetRunCommandHideConsole
(
hideconsole
);
// The OpenWatcom tools do not return an error code when a link
...
...
Source/cmGlobalGenerator.h
View file @
324d18bb
...
...
@@ -13,6 +13,7 @@
#include <utility>
#include <vector>
#include "cmAlgorithms.h"
#include "cmCustomCommandLines.h"
#include "cmDuration.h"
#include "cmExportSetMap.h"
...
...
@@ -203,10 +204,10 @@ public:
*/
int
Build
(
int
jobs
,
const
std
::
string
&
srcdir
,
const
std
::
string
&
bindir
,
const
std
::
string
&
projectName
,
const
std
::
string
&
targetName
,
std
::
string
&
output
,
const
std
::
string
&
makeProgram
,
const
std
::
string
&
config
,
bool
clean
,
bool
fast
,
bool
verbose
,
cmDuration
timeout
,
const
std
::
string
&
projectName
,
std
::
vector
<
std
::
string
>
const
&
targetNames
,
std
::
string
&
output
,
const
std
::
string
&
makeProgram
,
const
std
::
string
&
config
,
bool
clean
,
bool
fast
,
bool
verbose
,
cmDuration
timeout
,
cmSystemTools
::
OutputOption
outputflag
=
cmSystemTools
::
OUTPUT_NONE
,
std
::
vector
<
std
::
string
>
const
&
nativeOptions
=
std
::
vector
<
std
::
string
>
());
...
...
@@ -221,11 +222,10 @@ public:
{
};
virtual
void
GenerateBuildCommand
(
GeneratedMakeCommand
&
makeCommand
,
const
std
::
string
&
makeProgram
,
const
std
::
string
&
projectName
,
const
std
::
string
&
projectDir
,
const
std
::
string
&
targetName
,
const
std
::
string
&
config
,
bool
fast
,
int
jobs
,
bool
verbose
,
virtual
std
::
vector
<
GeneratedMakeCommand
>
GenerateBuildCommand
(
const
std
::
string
&
makeProgram
,
const
std
::
string
&
projectName
,
const
std
::
string
&
projectDir
,
std
::
vector
<
std
::
string
>
const
&
targetNames
,
const
std
::
string
&
config
,
bool
fast
,
int
jobs
,
bool
verbose
,
std
::
vector
<
std
::
string
>
const
&
makeOptions
=
std
::
vector
<
std
::
string
>
());
virtual
void
PrintBuildCommandAdvice
(
std
::
ostream
&
os
,
int
jobs
)
const
;
...
...
Source/cmGlobalGhsMultiGenerator.cxx
View file @
324d18bb
...
...
@@ -369,12 +369,14 @@ void cmGlobalGhsMultiGenerator::OutputTopLevelProject(
fout
.
Close
();
}
void
cmGlobalGhsMultiGenerator
::
GenerateBuildCommand
(
GeneratedMakeCommand
&
makeCommand
,
const
std
::
string
&
makeProgram
,
const
std
::
string
&
projectName
,
const
std
::
string
&
projectDir
,
const
std
::
string
&
targetName
,
const
std
::
string
&
/*config*/
,
bool
/*fast*/
,
int
jobs
,
bool
/*verbose*/
,
std
::
vector
<
std
::
string
>
const
&
makeOptions
)
std
::
vector
<
cmGlobalGenerator
::
GeneratedMakeCommand
>
cmGlobalGhsMultiGenerator
::
GenerateBuildCommand
(
const
std
::
string
&
makeProgram
,
const
std
::
string
&
projectName
,
const
std
::
string
&
projectDir
,
std
::
vector
<
std
::
string
>
const
&
targetNames
,
const
std
::
string
&
/*config*/
,
bool
/*fast*/
,
int
jobs
,
bool
/*verbose*/
,
std
::
vector
<
std
::
string
>
const
&
makeOptions
)
{
GeneratedMakeCommand
makeCommand
=
{};
const
char
*
gbuild
=
this
->
CMakeInstance
->
GetCacheDefinition
(
"CMAKE_MAKE_PROGRAM"
);
makeCommand
.
Add
(
this
->
SelectMakeProgram
(
makeProgram
,
(
std
::
string
)
gbuild
));
...
...
@@ -400,17 +402,23 @@ void cmGlobalGhsMultiGenerator::GenerateBuildCommand(
}
makeCommand
.
Add
(
"-top"
,
proj
);
if
(
!
targetName
.
empty
())
{
if
(
targetName
==
"clean"
)
{
if
(
!
targetNames
.
empty
())
{
if
(
std
::
find
(
targetNames
.
begin
(),
targetNames
.
end
(),
"clean"
)
!=
targetNames
.
end
())
{
makeCommand
.
Add
(
"-clean"
);
}
else
{
if
(
targetName
.
compare
(
targetName
.
size
()
-
4
,
4
,
".gpj"
)
==
0
)
{
makeCommand
.
Add
(
targetName
);
}
else
{
makeCommand
.
Add
(
targetName
+
".gpj"
);
for
(
const
auto
&
tname
:
targetNames
)
{
if
(
!
tname
.
empty
())
{
if
(
tname
.
compare
(
tname
.
size
()
-
4
,
4
,
".gpj"
)
==
0
)
{
makeCommand
.
Add
(
tname
);
}
else
{
makeCommand
.
Add
(
tname
+
".gpj"
);
}
}
}
}
}
return
{
makeCommand
};
}
void
cmGlobalGhsMultiGenerator
::
WriteMacros
(
std
::
ostream
&
fout
)
...
...
Source/cmGlobalGhsMultiGenerator.h
View file @
324d18bb
...
...
@@ -88,15 +88,12 @@ public:
protected:
void
Generate
()
override
;
void
GenerateBuildCommand
(
GeneratedMakeCommand
&
makeCommand
,
const
std
::
string
&
makeProgram
,
const
std
::
string
&
projectName
,
const
std
::
string
&
projectDir
,
const
std
::
string
&
targetName
,
const
std
::
string
&
config
,
bool
fast
,
int
jobs
,
bool
verbose
,
std
::
vector
<
std
::
string
>
const
&
makeOptions
=
std
::
vector
<
std
::
string
>
())
override
;
std
::
vector
<
GeneratedMakeCommand
>
GenerateBuildCommand
(
const
std
::
string
&
makeProgram
,
const
std
::
string
&
projectName
,
const
std
::
string
&
projectDir
,
std
::
vector
<
std
::
string
>
const
&
targetNames
,
const
std
::
string
&
config
,
bool
fast
,
int
jobs
,
bool
verbose
,
std
::
vector
<
std
::
string
>
const
&
makeOptions
=
std
::
vector
<
std
::
string
>
())
override
;
private:
void
GetToolset
(
cmMakefile
*
mf
,
std
::
string
&
tsd
,
const
std
::
string
&
ts
);
...
...
Source/cmGlobalJOMMakefileGenerator.cxx
View file @
324d18bb
...
...
@@ -54,11 +54,12 @@ void cmGlobalJOMMakefileGenerator::PrintCompilerAdvice(
this
->
cmGlobalUnixMakefileGenerator3
::
PrintCompilerAdvice
(
os
,
lang
,
envVar
);
}
void
cmGlobalJOMMakefileGenerator
::
GenerateBuildCommand
(
GeneratedMakeCommand
&
makeCommand
,
const
std
::
string
&
makeProgram
,
const
std
::
string
&
projectName
,
const
std
::
string
&
projectDir
,
const
std
::
string
&
targetName
,
const
std
::
string
&
config
,
bool
fast
,
int
jobs
,
bool
verbose
,
std
::
vector
<
std
::
string
>
const
&
makeOptions
)
std
::
vector
<
cmGlobalGenerator
::
GeneratedMakeCommand
>
cmGlobalJOMMakefileGenerator
::
GenerateBuildCommand
(
const
std
::
string
&
makeProgram
,
const
std
::
string
&
projectName
,
const
std
::
string
&
projectDir
,
std
::
vector
<
std
::
string
>
const
&
targetNames
,
const
std
::
string
&
config
,
bool
fast
,
int
jobs
,
bool
verbose
,
std
::
vector
<
std
::
string
>
const
&
makeOptions
)
{
std
::
vector
<
std
::
string
>
jomMakeOptions
;
...
...
@@ -75,7 +76,7 @@ void cmGlobalJOMMakefileGenerator::GenerateBuildCommand(
jobs
=
cmake
::
NO_BUILD_PARALLEL_LEVEL
;
}
cmGlobalUnixMakefileGenerator3
::
GenerateBuildCommand
(
makeCommand
,
makeProgram
,
projectName
,
projectDir
,
targetName
,
config
,
fast
,
jobs
,
verbose
,
jomMakeOptions
);
return
cmGlobalUnixMakefileGenerator3
::
GenerateBuildCommand
(
makeProgram
,
projectName
,
projectDir
,
targetName
s
,
config
,
fast
,
jobs
,
verbose
,
jomMakeOptions
);
}
Source/cmGlobalJOMMakefileGenerator.h
View file @
324d18bb
...
...
@@ -40,15 +40,12 @@ public:
bool
optional
)
override
;
protected:
void
GenerateBuildCommand
(
GeneratedMakeCommand
&
makeCommand
,
const
std
::
string
&
makeProgram
,
const
std
::
string
&
projectName
,
const
std
::
string
&
projectDir
,
const
std
::
string
&
targetName
,
const
std
::
string
&
config
,
bool
fast
,
int
jobs
,
bool
verbose
,
std
::
vector
<
std
::
string
>
const
&
makeOptions
=
std
::
vector
<
std
::
string
>
())
override
;
std
::
vector
<
GeneratedMakeCommand
>
GenerateBuildCommand
(
const
std
::
string
&
makeProgram
,
const
std
::
string
&
projectName
,
const
std
::
string
&
projectDir
,
std
::
vector
<
std
::
string
>
const
&
targetNames
,
const
std
::
string
&
config
,
bool
fast
,
int
jobs
,
bool
verbose
,
std
::
vector
<
std
::
string
>
const
&
makeOptions
=
std
::
vector
<
std
::
string
>
())
override
;
private:
void
PrintCompilerAdvice
(
std
::
ostream
&
os
,
std
::
string
const
&
lang
,
...
...
Source/cmGlobalNMakeMakefileGenerator.cxx
View file @
324d18bb
...
...
@@ -54,11 +54,12 @@ void cmGlobalNMakeMakefileGenerator::PrintCompilerAdvice(
this
->
cmGlobalUnixMakefileGenerator3
::
PrintCompilerAdvice
(
os
,
lang
,
envVar
);
}
void
cmGlobalNMakeMakefileGenerator
::
GenerateBuildCommand
(
GeneratedMakeCommand
&
makeCommand
,
const
std
::
string
&
makeProgram
,
const
std
::
string
&
projectName
,
const
std
::
string
&
projectDir
,
const
std
::
string
&
targetName
,
const
std
::
string
&
config
,
bool
fast
,
int
/*jobs*/
,
bool
verbose
,
std
::
vector
<
std
::
string
>
const
&
makeOptions
)
std
::
vector
<
cmGlobalGenerator
::
GeneratedMakeCommand
>
cmGlobalNMakeMakefileGenerator
::
GenerateBuildCommand
(
const
std
::
string
&
makeProgram
,
const
std
::
string
&
projectName
,
const
std
::
string
&
projectDir
,
std
::
vector
<
std
::
string
>
const
&
targetNames
,
const
std
::
string
&
config
,
bool
fast
,
int
/*jobs*/
,
bool
verbose
,
std
::
vector
<
std
::
string
>
const
&
makeOptions
)
{
std
::
vector
<
std
::
string
>
nmakeMakeOptions
;
...
...
@@ -68,9 +69,9 @@ void cmGlobalNMakeMakefileGenerator::GenerateBuildCommand(
nmakeMakeOptions
.
insert
(
nmakeMakeOptions
.
end
(),
makeOptions
.
begin
(),
makeOptions
.
end
());
this
->
cmGlobalUnixMakefileGenerator3
::
GenerateBuildCommand
(
makeCommand
,
makeProgram
,
projectName
,
projectDir
,
targetName
,
config
,
fast
,
cmake
::
NO_BUILD_PARALLEL_LEVEL
,
verbose
,
nmakeMakeOptions
);
return
this
->
cmGlobalUnixMakefileGenerator3
::
GenerateBuildCommand
(
makeProgram
,
projectName
,
projectDir
,
targetName
s
,
config
,
fast
,
cmake
::
NO_BUILD_PARALLEL_LEVEL
,
verbose
,
nmakeMakeOptions
);
}
void
cmGlobalNMakeMakefileGenerator
::
PrintBuildCommandAdvice
(
std
::
ostream
&
os
,
...
...
Source/cmGlobalNMakeMakefileGenerator.h
View file @
324d18bb
...
...
@@ -45,15 +45,12 @@ public:
bool
optional
)
override
;
protected:
void
GenerateBuildCommand
(
GeneratedMakeCommand
&
makeCommand
,
const
std
::
string
&
makeProgram
,
const
std
::
string
&
projectName
,
const
std
::
string
&
projectDir
,
const
std
::
string
&
targetName
,
const
std
::
string
&
config
,
bool
fast
,
int
jobs
,
bool
verbose
,
std
::
vector
<
std
::
string
>
const
&
makeOptions
=
std
::
vector
<
std
::
string
>
())
override
;
std
::
vector
<
GeneratedMakeCommand
>
GenerateBuildCommand
(
const
std
::
string
&
makeProgram
,
const
std
::
string
&
projectName
,
const
std
::
string
&
projectDir
,
std
::
vector
<
std
::
string
>
const
&
targetNames
,
const
std
::
string
&
config
,
bool
fast
,
int
jobs
,
bool
verbose
,
std
::
vector
<
std
::
string
>
const
&
makeOptions
=
std
::
vector
<
std
::
string
>
())
override
;
void
PrintBuildCommandAdvice
(
std
::
ostream
&
os
,
int
jobs
)
const
override
;
...
...
Source/cmGlobalNinjaGenerator.cxx
View file @
324d18bb
...
...
@@ -677,12 +677,15 @@ void cmGlobalNinjaGenerator::EnableLanguage(
// cmGlobalXCodeGenerator
// Called by:
// cmGlobalGenerator::Build()
void
cmGlobalNinjaGenerator
::
GenerateBuildCommand
(
GeneratedMakeCommand
&
makeCommand
,
const
std
::
string
&
makeProgram
,
const
std
::
string
&
/*projectName*/
,
const
std
::
string
&
/*projectDir*/
,
const
std
::
string
&
targetName
,
const
std
::
string
&
/*config*/
,
bool
/*fast*/
,
int
jobs
,
bool
verbose
,
std
::
vector
<
std
::
string
>
const
&
makeOptions
)
{
std
::
vector
<
cmGlobalGenerator
::
GeneratedMakeCommand
>
cmGlobalNinjaGenerator
::
GenerateBuildCommand
(
const
std
::
string
&
makeProgram
,
const
std
::
string
&
/*projectName*/
,
const
std
::
string
&
/*projectDir*/
,
std
::
vector
<
std
::
string
>
const
&
targetNames
,
const
std
::
string
&
/*config*/
,
bool
/*fast*/
,
int
jobs
,
bool
verbose
,
std
::
vector
<
std
::
string
>
const
&
makeOptions
)
{
GeneratedMakeCommand
makeCommand
;
makeCommand
.
Add
(
this
->
SelectMakeProgram
(
makeProgram
));
if
(
verbose
)
{
...
...
@@ -695,13 +698,16 @@ void cmGlobalNinjaGenerator::GenerateBuildCommand(
}
makeCommand
.
Add
(
makeOptions
.
begin
(),
makeOptions
.
end
());
if
(
!
targetName
.
empty
())
{
if
(
targetName
==
"clean"
)
{
makeCommand
.
Add
(
"-t"
,
"clean"
);
}
else
{
makeCommand
.
Add
(
targetName
);
for
(
const
auto
&
tname
:
targetNames
)
{
if
(
!
tname
.
empty
())
{
if
(
tname
==
"clean"
)
{
makeCommand
.
Add
(
"-t"
,
"clean"
);
}
else
{
makeCommand
.
Add
(
tname
);
}
}
}
return
{
std
::
move
(
makeCommand
)
};
}
// Non-virtual public methods.
...
...
Source/cmGlobalNinjaGenerator.h
View file @
324d18bb
...
...
@@ -200,15 +200,12 @@ public:
void
EnableLanguage
(
std
::
vector
<
std
::
string
>
const
&
languages
,
cmMakefile
*
mf
,
bool
optional
)
override
;
void
GenerateBuildCommand
(
GeneratedMakeCommand
&
makeCommand
,
const
std
::
string
&
makeProgram
,
const
std
::
string
&
projectName
,
const
std
::
string
&
projectDir
,
const
std
::
string
&
targetName
,
const
std
::
string
&
config
,
bool
fast
,
int
jobs
,
bool
verbose
,
std
::
vector
<
std
::
string
>
const
&
makeOptions
=
std
::
vector
<
std
::
string
>
())
override
;
std
::
vector
<
GeneratedMakeCommand
>
GenerateBuildCommand
(
const
std
::
string
&
makeProgram
,
const
std
::
string
&
projectName
,
const
std
::
string
&
projectDir
,
std
::
vector
<
std
::
string
>
const
&
targetNames
,
const
std
::
string
&
config
,
bool
fast
,
int
jobs
,
bool
verbose
,
std
::
vector
<
std
::
string
>
const
&
makeOptions
=
std
::
vector
<
std
::
string
>
())
override
;
// Setup target names
const
char
*
GetAllTargetName
()
const
override
{
return
"all"
;
}
...
...
Source/cmGlobalUnixMakefileGenerator3.cxx
View file @
324d18bb
...
...
@@ -494,11 +494,13 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRules2(
this
->
WriteDirectoryRule2
(
ruleFileStream
,
lg
,
"preinstall"
,
true
,
true
);
}
void
cmGlobalUnixMakefileGenerator3
::
GenerateBuildCommand
(
GeneratedMakeCommand
&
makeCommand
,
const
std
::
string
&
makeProgram
,
const
std
::
string
&
/*projectName*/
,
const
std
::
string
&
/*projectDir*/
,
const
std
::
string
&
targetName
,
const
std
::
string
&
/*config*/
,
bool
fast
,
int
jobs
,
bool
verbose
,
std
::
vector
<
std
::
string
>
const
&
makeOptions
)
std
::
vector
<
cmGlobalGenerator
::
GeneratedMakeCommand
>
cmGlobalUnixMakefileGenerator3
::
GenerateBuildCommand
(
const
std
::
string
&
makeProgram
,
const
std
::
string
&
/*projectName*/
,
const
std
::
string
&
/*projectDir*/
,
std
::
vector
<
std
::
string
>
const
&
targetNames
,
const
std
::
string
&
/*config*/
,
bool
fast
,
int
jobs
,
bool
verbose
,
std
::
vector
<
std
::
string
>
const
&
makeOptions
)
{
std
::
unique_ptr
<
cmMakefile
>
mfu
;
cmMakefile
*
mf
;
...
...
@@ -515,6 +517,8 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand(
mf
=
mfu
.
get
();
}
GeneratedMakeCommand
makeCommand
;
// Make it possible to set verbosity also from command line
if
(
verbose
)
{
makeCommand
.
Add
(
cmSystemTools
::
GetCMakeCommand
());
...
...
@@ -532,17 +536,19 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand(
}
makeCommand
.
Add
(
makeOptions
.
begin
(),
makeOptions
.
end
());
if
(
!
targetName
.
empty
())
{
std
::
string
tname
=
targetName
;
if
(
fast
)
{
tname
+=
"/fast"
;
for
(
auto
tname
:
targetNames
)
{
if
(
!
tname
.
empty
())
{
if
(
fast
)
{
tname
+=
"/fast"
;
}
tname
=