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
9ba0bf60
Commit
9ba0bf60
authored
Aug 06, 2019
by
wahikihiki
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmA*Command: Turn into free functions
Ref: #19499
parent
52d9cd62
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
257 additions
and
594 deletions
+257
-594
Source/cmAddCompileDefinitionsCommand.cxx
Source/cmAddCompileDefinitionsCommand.cxx
+5
-9
Source/cmAddCompileDefinitionsCommand.h
Source/cmAddCompileDefinitionsCommand.h
+2
-22
Source/cmAddCompileOptionsCommand.cxx
Source/cmAddCompileOptionsCommand.cxx
+5
-9
Source/cmAddCompileOptionsCommand.h
Source/cmAddCompileOptionsCommand.h
+2
-22
Source/cmAddCustomCommandCommand.cxx
Source/cmAddCustomCommandCommand.cxx
+43
-41
Source/cmAddCustomCommandCommand.h
Source/cmAddCustomCommandCommand.h
+2
-31
Source/cmAddCustomTargetCommand.cxx
Source/cmAddCustomTargetCommand.cxx
+19
-23
Source/cmAddCustomTargetCommand.h
Source/cmAddCustomTargetCommand.h
+2
-29
Source/cmAddDefinitionsCommand.cxx
Source/cmAddDefinitionsCommand.cxx
+5
-11
Source/cmAddDefinitionsCommand.h
Source/cmAddDefinitionsCommand.h
+2
-28
Source/cmAddDependenciesCommand.cxx
Source/cmAddDependenciesCommand.cxx
+10
-11
Source/cmAddDependenciesCommand.h
Source/cmAddDependenciesCommand.h
+2
-27
Source/cmAddExecutableCommand.cxx
Source/cmAddExecutableCommand.cxx
+28
-31
Source/cmAddExecutableCommand.h
Source/cmAddExecutableCommand.h
+2
-28
Source/cmAddLibraryCommand.cxx
Source/cmAddLibraryCommand.cxx
+48
-52
Source/cmAddLibraryCommand.h
Source/cmAddLibraryCommand.h
+2
-28
Source/cmAddLinkOptionsCommand.cxx
Source/cmAddLinkOptionsCommand.cxx
+5
-9
Source/cmAddLinkOptionsCommand.h
Source/cmAddLinkOptionsCommand.h
+2
-22
Source/cmAddSubDirectoryCommand.cxx
Source/cmAddSubDirectoryCommand.cxx
+16
-17
Source/cmAddSubDirectoryCommand.h
Source/cmAddSubDirectoryCommand.h
+2
-29
Source/cmAddTestCommand.cxx
Source/cmAddTestCommand.cxx
+27
-22
Source/cmAddTestCommand.h
Source/cmAddTestCommand.h
+2
-30
Source/cmAuxSourceDirectoryCommand.cxx
Source/cmAuxSourceDirectoryCommand.cxx
+10
-11
Source/cmAuxSourceDirectoryCommand.h
Source/cmAuxSourceDirectoryCommand.h
+2
-31
Source/cmCommands.cxx
Source/cmCommands.cxx
+12
-21
No files found.
Source/cmAddCompileDefinitionsCommand.cxx
View file @
9ba0bf60
...
...
@@ -2,19 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmAddCompileDefinitionsCommand.h"
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
class
cmExecutionStatus
;
bool
cmAddCompileDefinitionsCommand
::
InitialPass
(
std
::
vector
<
std
::
string
>
const
&
args
,
cmExecutionStatus
&
)
bool
cmAddCompileDefinitionsCommand
(
std
::
vector
<
std
::
string
>
const
&
args
,
cmExecutionStatus
&
status
)
{
if
(
args
.
empty
())
{
return
true
;
}
cmMakefile
&
mf
=
status
.
GetMakefile
();
for
(
std
::
string
const
&
i
:
args
)
{
this
->
Makefile
->
AddCompileDefinition
(
i
);
mf
.
AddCompileDefinition
(
i
);
}
return
true
;
}
Source/cmAddCompileDefinitionsCommand.h
View file @
9ba0bf60
...
...
@@ -8,29 +8,9 @@
#include <string>
#include <vector>
#include "cm_memory.hxx"
#include "cmCommand.h"
class
cmExecutionStatus
;
class
cmAddCompileDefinitionsCommand
:
public
cmCommand
{
public:
/**
* This is a virtual constructor for the command.
*/
std
::
unique_ptr
<
cmCommand
>
Clone
()
override
{
return
cm
::
make_unique
<
cmAddCompileDefinitionsCommand
>
();
}
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
bool
InitialPass
(
std
::
vector
<
std
::
string
>
const
&
args
,
cmExecutionStatus
&
status
)
override
;
};
bool
cmAddCompileDefinitionsCommand
(
std
::
vector
<
std
::
string
>
const
&
args
,
cmExecutionStatus
&
status
);
#endif
Source/cmAddCompileOptionsCommand.cxx
View file @
9ba0bf60
...
...
@@ -2,19 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmAddCompileOptionsCommand.h"
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
class
cmExecutionStatus
;
bool
cmAddCompileOptionsCommand
::
InitialPass
(
std
::
vector
<
std
::
string
>
const
&
args
,
cmExecutionStatus
&
)
bool
cmAddCompileOptionsCommand
(
std
::
vector
<
std
::
string
>
const
&
args
,
cmExecutionStatus
&
status
)
{
if
(
args
.
empty
())
{
return
true
;
}
cmMakefile
&
mf
=
status
.
GetMakefile
();
for
(
std
::
string
const
&
i
:
args
)
{
this
->
Makefile
->
AddCompileOption
(
i
);
mf
.
AddCompileOption
(
i
);
}
return
true
;
}
Source/cmAddCompileOptionsCommand.h
View file @
9ba0bf60
...
...
@@ -8,29 +8,9 @@
#include <string>
#include <vector>
#include "cm_memory.hxx"
#include "cmCommand.h"
class
cmExecutionStatus
;
class
cmAddCompileOptionsCommand
:
public
cmCommand
{
public:
/**
* This is a virtual constructor for the command.
*/
std
::
unique_ptr
<
cmCommand
>
Clone
()
override
{
return
cm
::
make_unique
<
cmAddCompileOptionsCommand
>
();
}
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
bool
InitialPass
(
std
::
vector
<
std
::
string
>
const
&
args
,
cmExecutionStatus
&
status
)
override
;
};
bool
cmAddCompileOptionsCommand
(
std
::
vector
<
std
::
string
>
const
&
args
,
cmExecutionStatus
&
status
);
#endif
Source/cmAddCustomCommandCommand.cxx
View file @
9ba0bf60
...
...
@@ -8,6 +8,7 @@
#include "cmCustomCommand.h"
#include "cmCustomCommandLines.h"
#include "cmExecutionStatus.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
...
...
@@ -16,21 +17,22 @@
#include "cmSystemTools.h"
#include "cmTarget.h"
class
cmExecutionStatus
;
static
bool
cmAddCustomCommandCommandCheckOutputs
(
const
std
::
vector
<
std
::
string
>&
outputs
,
cmExecutionStatus
&
status
);
// cmAddCustomCommandCommand
bool
cmAddCustomCommandCommand
::
InitialPass
(
std
::
vector
<
std
::
string
>
const
&
args
,
cmExecutionStatus
&
)
bool
cmAddCustomCommandCommand
(
std
::
vector
<
std
::
string
>
const
&
args
,
cmExecutionStatus
&
status
)
{
/* Let's complain at the end of this function about the lack of a particular
arg. For the moment, let's say that COMMAND, and either TARGET or SOURCE
are required.
*/
if
(
args
.
size
()
<
4
)
{
this
->
SetError
(
"called with wrong number of arguments."
);
status
.
SetError
(
"called with wrong number of arguments."
);
return
false
;
}
cmMakefile
&
mf
=
status
.
GetMakefile
();
std
::
string
source
,
target
,
main_dependency
,
working
,
depfile
,
job_pool
;
std
::
string
comment_buffer
;
const
char
*
comment
=
nullptr
;
...
...
@@ -167,9 +169,9 @@ bool cmAddCustomCommandCommand::InitialPass(
doing
=
doing_comment
;
}
else
if
(
copy
==
keyDEPFILE
)
{
doing
=
doing_depfile
;
if
(
this
->
Makefile
->
GetGlobalGenerator
()
->
GetName
()
!=
"Ninja"
)
{
this
->
SetError
(
"Option DEPFILE not supported by "
+
this
->
Makefile
->
GetGlobalGenerator
()
->
GetName
());
if
(
mf
.
GetGlobalGenerator
()
->
GetName
()
!=
"Ninja"
)
{
status
.
SetError
(
"Option DEPFILE not supported by "
+
mf
.
GetGlobalGenerator
()
->
GetName
());
return
false
;
}
}
else
if
(
copy
==
keyJOB_POOL
)
{
...
...
@@ -192,7 +194,7 @@ bool cmAddCustomCommandCommand::InitialPass(
// and later references "${CMAKE_CURRENT_SOURCE_DIR}/out.txt".
// This is fairly obscure so we can wait for someone to
// complain.
filename
=
this
->
Makefile
->
GetCurrentBinaryDirectory
();
filename
=
mf
.
GetCurrentBinaryDirectory
();
filename
+=
"/"
;
}
filename
+=
copy
;
...
...
@@ -269,7 +271,7 @@ bool cmAddCustomCommandCommand::InitialPass(
comment
=
comment_buffer
.
c_str
();
break
;
default:
this
->
SetError
(
"Wrong syntax. Unknown type of argument."
);
status
.
SetError
(
"Wrong syntax. Unknown type of argument."
);
return
false
;
}
}
...
...
@@ -284,31 +286,31 @@ bool cmAddCustomCommandCommand::InitialPass(
// At this point we could complain about the lack of arguments. For
// the moment, let's say that COMMAND, TARGET are always required.
if
(
output
.
empty
()
&&
target
.
empty
())
{
this
->
SetError
(
"Wrong syntax. A TARGET or OUTPUT must be specified."
);
status
.
SetError
(
"Wrong syntax. A TARGET or OUTPUT must be specified."
);
return
false
;
}
if
(
source
.
empty
()
&&
!
target
.
empty
()
&&
!
output
.
empty
())
{
this
->
SetError
(
status
.
SetError
(
"Wrong syntax. A TARGET and OUTPUT can not both be specified."
);
return
false
;
}
if
(
append
&&
output
.
empty
())
{
this
->
SetError
(
"given APPEND option with no OUTPUT."
);
status
.
SetError
(
"given APPEND option with no OUTPUT."
);
return
false
;
}
// Make sure the output names and locations are safe.
if
(
!
this
->
CheckOutputs
(
output
)
||
!
this
->
CheckOutputs
(
outputs
)
||
!
this
->
CheckOutputs
(
byproducts
))
{
if
(
!
cmAddCustomCommandCommandCheckOutputs
(
output
,
status
)
||
!
cmAddCustomCommandCommandCheckOutputs
(
outputs
,
status
)
||
!
cmAddCustomCommandCommandCheckOutputs
(
byproducts
,
status
))
{
return
false
;
}
// Check for an append request.
if
(
append
)
{
// Lookup an existing command.
if
(
cmSourceFile
*
sf
=
this
->
Makefile
->
GetSourceFileWithOutput
(
output
[
0
]))
{
if
(
cmSourceFile
*
sf
=
mf
.
GetSourceFileWithOutput
(
output
[
0
]))
{
if
(
cmCustomCommand
*
cc
=
sf
->
GetCustomCommand
())
{
cc
->
AppendCommands
(
commandLines
);
cc
->
AppendDepends
(
depends
);
...
...
@@ -321,12 +323,12 @@ bool cmAddCustomCommandCommand::InitialPass(
std
::
ostringstream
e
;
e
<<
"given APPEND option with output
\n\"
"
<<
output
[
0
]
<<
"
\"\n
which is not already a custom command output."
;
this
->
SetError
(
e
.
str
());
status
.
SetError
(
e
.
str
());
return
false
;
}
if
(
uses_terminal
&&
!
job_pool
.
empty
())
{
this
->
SetError
(
"JOB_POOL is shadowed by USES_TERMINAL."
);
status
.
SetError
(
"JOB_POOL is shadowed by USES_TERMINAL."
);
return
false
;
}
...
...
@@ -335,22 +337,21 @@ bool cmAddCustomCommandCommand::InitialPass(
if
(
source
.
empty
()
&&
output
.
empty
())
{
// Source is empty, use the target.
std
::
vector
<
std
::
string
>
no_depends
;
this
->
Makefile
->
AddCustomCommandToTarget
(
target
,
byproducts
,
no_depends
,
commandLines
,
cctype
,
comment
,
working
.
c_str
(),
escapeOldStyle
,
uses_terminal
,
depfile
,
job_pool
,
command_expand_lists
);
mf
.
AddCustomCommandToTarget
(
target
,
byproducts
,
no_depends
,
commandLines
,
cctype
,
comment
,
working
.
c_str
()
,
escapeOldStyle
,
uses_terminal
,
depfile
,
job_pool
,
command_expand_lists
);
}
else
if
(
target
.
empty
())
{
// Target is empty, use the output.
this
->
Makefile
->
AddCustomCommandToOutput
(
output
,
byproducts
,
depends
,
main_dependency
,
commandLines
,
comment
,
working
.
c_str
(),
false
,
escapeOldStyle
,
uses_terminal
,
command_expand_lists
,
depfile
,
job_pool
);
mf
.
AddCustomCommandToOutput
(
output
,
byproducts
,
depends
,
main_dependency
,
commandLines
,
comment
,
working
.
c_str
(),
false
,
escapeOldStyle
,
uses_terminal
,
command_expand_lists
,
depfile
,
job_pool
);
// Add implicit dependency scanning requests if any were given.
if
(
!
implicit_depends
.
empty
())
{
bool
okay
=
false
;
if
(
cmSourceFile
*
sf
=
this
->
Makefile
->
GetSourceFileWithOutput
(
output
[
0
]))
{
if
(
cmSourceFile
*
sf
=
mf
.
GetSourceFileWithOutput
(
output
[
0
]))
{
if
(
cmCustomCommand
*
cc
=
sf
->
GetCustomCommand
())
{
okay
=
true
;
cc
->
SetImplicitDepends
(
implicit_depends
);
...
...
@@ -360,21 +361,21 @@ bool cmAddCustomCommandCommand::InitialPass(
std
::
ostringstream
e
;
e
<<
"could not locate source file with a custom command producing
\"
"
<<
output
[
0
]
<<
"
\"
even though this command tried to create it!"
;
this
->
SetError
(
e
.
str
());
status
.
SetError
(
e
.
str
());
return
false
;
}
}
}
else
if
(
!
byproducts
.
empty
())
{
this
->
SetError
(
"BYPRODUCTS may not be specified with SOURCE signatures"
);
status
.
SetError
(
"BYPRODUCTS may not be specified with SOURCE signatures"
);
return
false
;
}
else
if
(
uses_terminal
)
{
this
->
SetError
(
"USES_TERMINAL may not be used with SOURCE signatures"
);
status
.
SetError
(
"USES_TERMINAL may not be used with SOURCE signatures"
);
return
false
;
}
else
{
bool
issueMessage
=
true
;
std
::
ostringstream
e
;
MessageType
messageType
=
MessageType
::
AUTHOR_WARNING
;
switch
(
this
->
Makefile
->
GetPolicyStatus
(
cmPolicies
::
CMP0050
))
{
switch
(
mf
.
GetPolicyStatus
(
cmPolicies
::
CMP0050
))
{
case
cmPolicies
::
WARN
:
e
<<
cmPolicies
::
GetPolicyWarning
(
cmPolicies
::
CMP0050
)
<<
"
\n
"
;
break
;
...
...
@@ -391,30 +392,31 @@ bool cmAddCustomCommandCommand::InitialPass(
if
(
issueMessage
)
{
e
<<
"The SOURCE signatures of add_custom_command are no longer "
"supported."
;
this
->
Makefile
->
IssueMessage
(
messageType
,
e
.
str
());
mf
.
IssueMessage
(
messageType
,
e
.
str
());
if
(
messageType
==
MessageType
::
FATAL_ERROR
)
{
return
false
;
}
}
// Use the old-style mode for backward compatibility.
this
->
Makefile
->
AddCustomCommandOldStyle
(
target
,
outputs
,
depends
,
source
,
commandLines
,
comment
);
mf
.
AddCustomCommandOldStyle
(
target
,
outputs
,
depends
,
source
,
commandLines
,
comment
);
}
return
true
;
}
bool
cmAddCustomCommandCommand
::
CheckOutputs
(
const
std
::
vector
<
std
::
string
>&
outputs
)
bool
cmAddCustomCommandCommandCheckOutputs
(
const
std
::
vector
<
std
::
string
>&
outputs
,
cmExecutionStatus
&
status
)
{
cmMakefile
&
mf
=
status
.
GetMakefile
();
for
(
std
::
string
const
&
o
:
outputs
)
{
// Make sure the file will not be generated into the source
// directory during an out of source build.
if
(
!
this
->
Makefile
->
CanIWriteThisFile
(
o
))
{
if
(
!
mf
.
CanIWriteThisFile
(
o
))
{
std
::
string
e
=
"attempted to have a file
\"
"
+
o
+
"
\"
in a source directory as an output of custom command."
;
this
->
SetError
(
e
);
status
.
SetError
(
e
);
cmSystemTools
::
SetFatalErrorOccured
();
return
false
;
}
...
...
@@ -425,7 +427,7 @@ bool cmAddCustomCommandCommand::CheckOutputs(
std
::
ostringstream
msg
;
msg
<<
"called with OUTPUT containing a
\"
"
<<
o
[
pos
]
<<
"
\"
. This character is not allowed."
;
this
->
SetError
(
msg
.
str
());
status
.
SetError
(
msg
.
str
());
return
false
;
}
}
...
...
Source/cmAddCustomCommandCommand.h
View file @
9ba0bf60
...
...
@@ -8,38 +8,9 @@
#include <string>
#include <vector>
#include "cm_memory.hxx"
#include "cmCommand.h"
class
cmExecutionStatus
;
/** \class cmAddCustomCommandCommand
* \brief cmAddCustomCommandCommand defines a new command (rule) that can
* be executed within the build process
*
*/
class
cmAddCustomCommandCommand
:
public
cmCommand
{
public:
/**
* This is a virtual constructor for the command.
*/
std
::
unique_ptr
<
cmCommand
>
Clone
()
override
{
return
cm
::
make_unique
<
cmAddCustomCommandCommand
>
();
}
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
bool
InitialPass
(
std
::
vector
<
std
::
string
>
const
&
args
,
cmExecutionStatus
&
status
)
override
;
protected:
bool
CheckOutputs
(
const
std
::
vector
<
std
::
string
>&
outputs
);
};
bool
cmAddCustomCommandCommand
(
std
::
vector
<
std
::
string
>
const
&
args
,
cmExecutionStatus
&
status
);
#endif
Source/cmAddCustomTargetCommand.cxx
View file @
9ba0bf60
...
...
@@ -6,6 +6,7 @@
#include <utility>
#include "cmCustomCommandLines.h"
#include "cmExecutionStatus.h"
#include "cmGeneratorExpression.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
...
...
@@ -14,17 +15,15 @@
#include "cmSystemTools.h"
#include "cmTarget.h"
class
cmExecutionStatus
;
// cmAddCustomTargetCommand
bool
cmAddCustomTargetCommand
::
InitialPass
(
std
::
vector
<
std
::
string
>
const
&
args
,
cmExecutionStatus
&
)
bool
cmAddCustomTargetCommand
(
std
::
vector
<
std
::
string
>
const
&
args
,
cmExecutionStatus
&
status
)
{
if
(
args
.
empty
())
{
this
->
SetError
(
"called with incorrect number of arguments"
);
status
.
SetError
(
"called with incorrect number of arguments"
);
return
false
;
}
cmMakefile
&
mf
=
status
.
GetMakefile
();
std
::
string
const
&
targetName
=
args
[
0
];
// Check the target name.
...
...
@@ -33,7 +32,7 @@ bool cmAddCustomTargetCommand::InitialPass(
e
<<
"called with invalid target name
\"
"
<<
targetName
<<
"
\"
. Target names may not contain a slash. "
<<
"Use ADD_CUSTOM_COMMAND to generate files."
;
this
->
SetError
(
e
.
str
());
status
.
SetError
(
e
.
str
());
return
false
;
}
...
...
@@ -122,7 +121,7 @@ bool cmAddCustomTargetCommand::InitialPass(
case
doing_byproducts
:
{
std
::
string
filename
;
if
(
!
cmSystemTools
::
FileIsFullPath
(
copy
))
{
filename
=
this
->
Makefile
->
GetCurrentBinaryDirectory
();
filename
=
mf
.
GetCurrentBinaryDirectory
();
filename
+=
"/"
;
}
filename
+=
copy
;
...
...
@@ -145,7 +144,7 @@ bool cmAddCustomTargetCommand::InitialPass(
job_pool
=
copy
;
break
;
default:
this
->
SetError
(
"Wrong syntax. Unknown type of argument."
);
status
.
SetError
(
"Wrong syntax. Unknown type of argument."
);
return
false
;
}
}
...
...
@@ -156,7 +155,7 @@ bool cmAddCustomTargetCommand::InitialPass(
std
::
ostringstream
msg
;
msg
<<
"called with target name containing a
\"
"
<<
targetName
[
pos
]
<<
"
\"
. This character is not allowed."
;
this
->
SetError
(
msg
.
str
());
status
.
SetError
(
msg
.
str
());
return
false
;
}
...
...
@@ -168,8 +167,7 @@ bool cmAddCustomTargetCommand::InitialPass(
if
(
nameOk
)
{
nameOk
=
targetName
.
find
(
':'
)
==
std
::
string
::
npos
;
}
if
(
!
nameOk
&&
!
this
->
Makefile
->
CheckCMP0037
(
targetName
,
cmStateEnums
::
UTILITY
))
{
if
(
!
nameOk
&&
!
mf
.
CheckCMP0037
(
targetName
,
cmStateEnums
::
UTILITY
))
{
return
false
;
}
...
...
@@ -182,39 +180,37 @@ bool cmAddCustomTargetCommand::InitialPass(
// Enforce name uniqueness.
{
std
::
string
msg
;
if
(
!
this
->
Makefile
->
EnforceUniqueName
(
targetName
,
msg
,
true
))
{
this
->
SetError
(
msg
);
if
(
!
mf
.
EnforceUniqueName
(
targetName
,
msg
,
true
))
{
status
.
SetError
(
msg
);
return
false
;
}
}
if
(
commandLines
.
empty
()
&&
!
byproducts
.
empty
())
{
this
->
Makefile
->
IssueMessage
(
MessageType
::
FATAL_ERROR
,
"BYPRODUCTS may not be specified without any COMMAND"
);
mf
.
IssueMessage
(
MessageType
::
FATAL_ERROR
,
"BYPRODUCTS may not be specified without any COMMAND"
);
return
true
;
}
if
(
commandLines
.
empty
()
&&
uses_terminal
)
{
this
->
Makefile
->
IssueMessage
(
MessageType
::
FATAL_ERROR
,
"USES_TERMINAL may not be specified without any COMMAND"
);
mf
.
IssueMessage
(
MessageType
::
FATAL_ERROR
,
"USES_TERMINAL may not be specified without any COMMAND"
);
return
true
;
}
if
(
commandLines
.
empty
()
&&
command_expand_lists
)
{
this
->
Makefile
->
IssueMessage
(
mf
.
IssueMessage
(
MessageType
::
FATAL_ERROR
,
"COMMAND_EXPAND_LISTS may not be specified without any COMMAND"
);
return
true
;
}
if
(
uses_terminal
&&
!
job_pool
.
empty
())
{
this
->
SetError
(
"JOB_POOL is shadowed by USES_TERMINAL."
);
status
.
SetError
(
"JOB_POOL is shadowed by USES_TERMINAL."
);
return
false
;
}
// Add the utility target to the makefile.
bool
escapeOldStyle
=
!
verbatim
;
cmTarget
*
target
=
this
->
Makefile
->
AddUtilityCommand
(
cmTarget
*
target
=
mf
.
AddUtilityCommand
(
targetName
,
cmMakefile
::
TargetOrigin
::
Project
,
excludeFromAll
,
working_directory
.
c_str
(),
byproducts
,
depends
,
commandLines
,
escapeOldStyle
,
comment
,
uses_terminal
,
command_expand_lists
,
job_pool
);
...
...
Source/cmAddCustomTargetCommand.h
View file @
9ba0bf60
...
...
@@ -8,36 +8,9 @@
#include <string>
#include <vector>
#include "cm_memory.hxx"
#include "cmCommand.h"
class
cmExecutionStatus
;
/** \class cmAddCustomTargetCommand
* \brief Command that adds a target to the build system.
*
* cmAddCustomTargetCommand adds an extra target to the build system.
* This is useful when you would like to add special
* targets like "install,", "clean," and so on.
*/
class
cmAddCustomTargetCommand
:
public
cmCommand
{
public:
/**
* This is a virtual constructor for the command.
*/
std
::
unique_ptr
<
cmCommand
>
Clone
()
override
{
return
cm
::
make_unique
<
cmAddCustomTargetCommand
>
();
}
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
bool
InitialPass
(
std
::
vector
<
std
::
string
>
const
&
args
,
cmExecutionStatus
&
status
)
override
;
};
bool
cmAddCustomTargetCommand
(
std
::
vector
<
std
::
string
>
const
&
args
,
cmExecutionStatus
&
status
);
#endif
Source/cmAddDefinitionsCommand.cxx
View file @
9ba0bf60
...
...
@@ -2,21 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmAddDefinitionsCommand.h"
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
class
cmExecutionStatus
;
// cmAddDefinitionsCommand
bool
cmAddDefinitionsCommand
::
InitialPass
(
std
::
vector
<
std
::
string
>
const
&
args
,
cmExecutionStatus
&
)
bool
cmAddDefinitionsCommand
(
std
::
vector
<
std
::
string
>
const
&
args
,
cmExecutionStatus
&
status
)
{
// it is OK to have no arguments
if
(
args
.
empty
())
{
return
true
;
}
cmMakefile
&
mf
=
status
.
GetMakefile
();
for
(
std
::
string
const
&
i
:
args
)
{
this
->
Makefile
->
AddDefineFlag
(
i
);
mf
.
AddDefineFlag
(
i
);
}
return
true
;
}
Source/cmAddDefinitionsCommand.h
View file @
9ba0bf60
...
...
@@ -8,35 +8,9 @@
#include <string>
#include <vector>
#include "cm_memory.hxx"
#include "cmCommand.h"
class
cmExecutionStatus
;
/** \class cmAddDefinitionsCommand
* \brief Specify a list of compiler defines
*
* cmAddDefinitionsCommand specifies a list of compiler defines. These defines
* will be added to the compile command.
*/
class
cmAddDefinitionsCommand
:
public
cmCommand
{
public:
/**
* This is a virtual constructor for the command.
*/
std
::
unique_ptr
<
cmCommand
>
Clone
()
override
{
return
cm
::
make_unique
<
cmAddDefinitionsCommand
>
();
}
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
bool
InitialPass
(
std
::
vector
<
std
::
string
>
const
&
args
,
cmExecutionStatus
&
status
)
override
;
};