Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
CMake
CMake
Commits
24bce99c
Commit
24bce99c
authored
Apr 19, 2001
by
Ken Martin
Browse files
cleaned up the coding style made ivars private etc
parent
57c4325c
Changes
10
Hide whitespace changes
Inline
Side-by-side
Source/cmCablePackageCommand.cxx
View file @
24bce99c
...
...
@@ -117,7 +117,7 @@ bool cmCablePackageCommand::Invoke(std::vector<std::string>& args)
outputs
,
m_TargetName
.
c_str
());
// add the source list to the target
m_Makefile
->
GetTargets
()[
m_TargetName
.
c_str
()].
m_
SourceLists
.
push_back
(
m_PackageName
);
m_Makefile
->
GetTargets
()[
m_TargetName
.
c_str
()].
Get
SourceLists
()
.
push_back
(
m_PackageName
);
return
true
;
}
...
...
Source/cmCustomCommand.h
View file @
24bce99c
...
...
@@ -19,6 +19,11 @@
#include
"cmStandardIncludes.h"
class
cmMakefile
;
/** \class cmCustomCommand
* \brief A class to encapsulate a custom command
*
* cmCustomCommand encapsulates the properties of a custom command
*/
class
cmCustomCommand
{
public:
...
...
@@ -26,8 +31,38 @@ public:
std
::
vector
<
std
::
string
>
dep
,
std
::
vector
<
std
::
string
>
out
);
cmCustomCommand
(
const
cmCustomCommand
&
r
);
/**
* Use the cmMakefile's Expand commands to expand any variables in
* this objects members.
*/
void
ExpandVariables
(
const
cmMakefile
&
);
/**
* Return the name of the source file. I'm not sure if this is a full path or not.
*/
std
::
string
GetSourceName
()
const
{
return
m_Source
;}
void
SetSourceName
(
const
char
*
name
)
{
m_Source
=
name
;}
/**
* Return the command to execute
*/
std
::
string
GetCommand
()
const
{
return
m_Command
;}
void
SetCommand
(
const
char
*
cmd
)
{
m_Command
=
cmd
;}
/**
* Return the vector that holds the list of dependencies
*/
const
std
::
vector
<
std
::
string
>
&
GetDepends
()
const
{
return
m_Depends
;}
std
::
vector
<
std
::
string
>
&
GetDepends
()
{
return
m_Depends
;}
/**
* Return the vector that holds the list of outputs of this command
*/
const
std
::
vector
<
std
::
string
>
&
GetOutputs
()
const
{
return
m_Outputs
;}
std
::
vector
<
std
::
string
>
&
GetOutputs
()
{
return
m_Outputs
;}
private:
std
::
string
m_Source
;
std
::
string
m_Command
;
std
::
vector
<
std
::
string
>
m_Depends
;
...
...
Source/cmDSPMakefile.cxx
View file @
24bce99c
...
...
@@ -91,7 +91,7 @@ void cmDSPMakefile::OutputDSPFile()
for
(
cmTargets
::
const_iterator
l
=
tgts
.
begin
();
l
!=
tgts
.
end
();
l
++
)
{
if
(
l
->
second
.
m_
IsALibrary
)
if
(
l
->
second
.
IsALibrary
()
)
{
this
->
SetBuildType
(
m_LibraryBuildType
,
l
->
first
.
c_str
());
}
...
...
@@ -196,7 +196,7 @@ void cmDSPMakefile::WriteDSPFile(std::ostream& fout,
// get the classes from the source lists then add them to the groups
std
::
vector
<
cmClassFile
>
classes
=
m_Makefile
->
GetClassesFromSourceLists
(
target
.
m_
SourceLists
);
m_Makefile
->
GetClassesFromSourceLists
(
target
.
Get
SourceLists
()
);
for
(
std
::
vector
<
cmClassFile
>::
iterator
i
=
classes
.
begin
();
i
!=
classes
.
end
();
i
++
)
{
...
...
@@ -212,11 +212,11 @@ void cmDSPMakefile::WriteDSPFile(std::ostream& fout,
// add any custom rules to the source groups
for
(
std
::
vector
<
cmCustomCommand
>::
const_iterator
cr
=
target
.
m_
CustomCommands
.
begin
();
cr
!=
target
.
m_
CustomCommands
.
end
();
++
cr
)
target
.
Get
CustomCommands
()
.
begin
();
cr
!=
target
.
Get
CustomCommands
()
.
end
();
++
cr
)
{
cmSourceGroup
&
sourceGroup
=
m_Makefile
->
FindSourceGroup
(
cr
->
m_
Source
.
c_str
(),
m_Makefile
->
FindSourceGroup
(
cr
->
Get
Source
Name
()
.
c_str
(),
sourceGroups
);
cmCustomCommand
cc
(
*
cr
);
cc
.
ExpandVariables
(
*
m_Makefile
);
...
...
Source/cmDSPWriter.cxx
View file @
24bce99c
...
...
@@ -91,7 +91,7 @@ void cmDSPMakefile::OutputDSPFile()
for
(
cmTargets
::
const_iterator
l
=
tgts
.
begin
();
l
!=
tgts
.
end
();
l
++
)
{
if
(
l
->
second
.
m_
IsALibrary
)
if
(
l
->
second
.
IsALibrary
()
)
{
this
->
SetBuildType
(
m_LibraryBuildType
,
l
->
first
.
c_str
());
}
...
...
@@ -196,7 +196,7 @@ void cmDSPMakefile::WriteDSPFile(std::ostream& fout,
// get the classes from the source lists then add them to the groups
std
::
vector
<
cmClassFile
>
classes
=
m_Makefile
->
GetClassesFromSourceLists
(
target
.
m_
SourceLists
);
m_Makefile
->
GetClassesFromSourceLists
(
target
.
Get
SourceLists
()
);
for
(
std
::
vector
<
cmClassFile
>::
iterator
i
=
classes
.
begin
();
i
!=
classes
.
end
();
i
++
)
{
...
...
@@ -212,11 +212,11 @@ void cmDSPMakefile::WriteDSPFile(std::ostream& fout,
// add any custom rules to the source groups
for
(
std
::
vector
<
cmCustomCommand
>::
const_iterator
cr
=
target
.
m_
CustomCommands
.
begin
();
cr
!=
target
.
m_
CustomCommands
.
end
();
++
cr
)
target
.
Get
CustomCommands
()
.
begin
();
cr
!=
target
.
Get
CustomCommands
()
.
end
();
++
cr
)
{
cmSourceGroup
&
sourceGroup
=
m_Makefile
->
FindSourceGroup
(
cr
->
m_
Source
.
c_str
(),
m_Makefile
->
FindSourceGroup
(
cr
->
Get
Source
Name
()
.
c_str
(),
sourceGroups
);
cmCustomCommand
cc
(
*
cr
);
cc
.
ExpandVariables
(
*
m_Makefile
);
...
...
Source/cmDSWMakefile.cxx
View file @
24bce99c
...
...
@@ -134,7 +134,7 @@ void cmDSWMakefile::WriteProject(std::ostream& fout,
{
if
(
*
i
!=
dspname
)
{
if
(
!
l
.
m_
IsALibrary
||
if
(
!
l
.
IsALibrary
()
||
project
->
GetLibraryBuildType
()
==
cmDSPMakefile
::
DLL
)
{
fout
<<
"Begin Project Dependency
\n
"
;
...
...
Source/cmDSWWriter.cxx
View file @
24bce99c
...
...
@@ -134,7 +134,7 @@ void cmDSWMakefile::WriteProject(std::ostream& fout,
{
if
(
*
i
!=
dspname
)
{
if
(
!
l
.
m_
IsALibrary
||
if
(
!
l
.
IsALibrary
()
||
project
->
GetLibraryBuildType
()
==
cmDSPMakefile
::
DLL
)
{
fout
<<
"Begin Project Dependency
\n
"
;
...
...
Source/cmMakefile.cxx
View file @
24bce99c
...
...
@@ -304,7 +304,7 @@ void cmMakefile::AddCustomCommand(const char* source,
if
(
m_Targets
.
find
(
target
)
!=
m_Targets
.
end
())
{
cmCustomCommand
cc
(
source
,
command
,
depends
,
outputs
);
m_Targets
[
target
].
m_
CustomCommands
.
push_back
(
cc
);
m_Targets
[
target
].
Get
CustomCommands
()
.
push_back
(
cc
);
}
}
...
...
@@ -368,8 +368,8 @@ void cmMakefile::SetProjectName(const char* p)
void
cmMakefile
::
AddLibrary
(
const
char
*
lname
,
const
std
::
vector
<
std
::
string
>
&
srcs
)
{
cmTarget
target
;
target
.
m_
IsALibrary
=
1
;
target
.
m_
SourceLists
=
srcs
;
target
.
Set
IsALibrary
(
1
)
;
target
.
Get
SourceLists
()
=
srcs
;
m_Targets
.
insert
(
cmTargets
::
value_type
(
lname
,
target
));
}
...
...
@@ -377,8 +377,8 @@ void cmMakefile::AddExecutable(const char *exeName,
const
std
::
vector
<
std
::
string
>
&
srcs
)
{
cmTarget
target
;
target
.
m_
IsALibrary
=
0
;
target
.
m_
SourceLists
=
srcs
;
target
.
Set
IsALibrary
(
0
)
;
target
.
Get
SourceLists
()
=
srcs
;
m_Targets
.
insert
(
cmTargets
::
value_type
(
exeName
,
target
));
}
...
...
Source/cmSourceGroup.cxx
View file @
24bce99c
...
...
@@ -55,30 +55,30 @@ bool cmSourceGroup::Matches(const char* name)
*/
void
cmSourceGroup
::
AddCustomCommand
(
const
cmCustomCommand
&
cmd
)
{
CustomCommands
::
iterator
s
=
m_CustomCommands
.
find
(
cmd
.
m_
Source
);
CustomCommands
::
iterator
s
=
m_CustomCommands
.
find
(
cmd
.
Get
Source
Name
()
);
if
(
s
==
m_CustomCommands
.
end
())
{
// The source was not found. Add it with this command.
m_CustomCommands
[
cmd
.
m_
Source
][
cmd
.
m_
Command
].
m_Depends
.
insert
(
cmd
.
m_
Depends
.
begin
(),
cmd
.
m_
Depends
.
end
());
m_CustomCommands
[
cmd
.
m_
Source
][
cmd
.
m_
Command
].
m_Outputs
.
insert
(
cmd
.
m_
Outputs
.
begin
(),
cmd
.
m_
Outputs
.
end
());
m_CustomCommands
[
cmd
.
Get
Source
Name
()
][
cmd
.
Get
Command
()
].
m_Depends
.
insert
(
cmd
.
Get
Depends
()
.
begin
(),
cmd
.
Get
Depends
()
.
end
());
m_CustomCommands
[
cmd
.
Get
Source
Name
()
][
cmd
.
Get
Command
()
].
m_Outputs
.
insert
(
cmd
.
Get
Outputs
()
.
begin
(),
cmd
.
Get
Outputs
()
.
end
());
return
;
}
// The source already exists. See if the command exists.
Commands
&
commands
=
s
->
second
;
Commands
::
iterator
c
=
commands
.
find
(
cmd
.
m_
Command
);
Commands
::
iterator
c
=
commands
.
find
(
cmd
.
Get
Command
()
);
if
(
c
==
commands
.
end
())
{
// The command did not exist. Add it.
commands
[
cmd
.
m_
Command
].
m_Depends
.
insert
(
cmd
.
m_
Depends
.
begin
(),
cmd
.
m_
Depends
.
end
());
commands
[
cmd
.
m_
Command
].
m_Outputs
.
insert
(
cmd
.
m_
Outputs
.
begin
(),
cmd
.
m_
Outputs
.
end
());
commands
[
cmd
.
Get
Command
()
].
m_Depends
.
insert
(
cmd
.
Get
Depends
()
.
begin
(),
cmd
.
Get
Depends
()
.
end
());
commands
[
cmd
.
Get
Command
()
].
m_Outputs
.
insert
(
cmd
.
Get
Outputs
()
.
begin
(),
cmd
.
Get
Outputs
()
.
end
());
return
;
}
// The command already exists for this source. Merge the sets.
CommandFiles
&
commandFiles
=
c
->
second
;
commandFiles
.
m_Depends
.
insert
(
cmd
.
m_
Depends
.
begin
(),
cmd
.
m_
Depends
.
end
());
commandFiles
.
m_Outputs
.
insert
(
cmd
.
m_
Outputs
.
begin
(),
cmd
.
m_
Outputs
.
end
());
commandFiles
.
m_Depends
.
insert
(
cmd
.
Get
Depends
()
.
begin
(),
cmd
.
Get
Depends
()
.
end
());
commandFiles
.
m_Outputs
.
insert
(
cmd
.
Get
Outputs
()
.
begin
(),
cmd
.
Get
Outputs
()
.
end
());
}
Source/cmTarget.h
View file @
24bce99c
...
...
@@ -28,9 +28,29 @@
class
cmTarget
{
public:
/**
* is this target a library?
*/
bool
IsALibrary
()
const
{
return
m_IsALibrary
;
}
bool
GetIsALibrary
()
const
{
return
m_IsALibrary
;
}
void
SetIsALibrary
(
bool
f
)
{
m_IsALibrary
=
f
;
}
/**
* Get the list of the custom commands for this target
*/
const
std
::
vector
<
cmCustomCommand
>
&
GetCustomCommands
()
const
{
return
m_CustomCommands
;}
std
::
vector
<
cmCustomCommand
>
&
GetCustomCommands
()
{
return
m_CustomCommands
;}
/**
* Get the list of the source lists used by this target
*/
const
std
::
vector
<
std
::
string
>
&
GetSourceLists
()
const
{
return
m_SourceLists
;}
std
::
vector
<
std
::
string
>
&
GetSourceLists
()
{
return
m_SourceLists
;}
private:
std
::
vector
<
cmCustomCommand
>
m_CustomCommands
;
bool
m_IsALibrary
;
std
::
vector
<
std
::
string
>
m_SourceLists
;
bool
m_IsALibrary
;
};
typedef
std
::
map
<
std
::
string
,
cmTarget
>
cmTargets
;
...
...
Source/cmUnixMakefileGenerator.cxx
View file @
24bce99c
...
...
@@ -74,7 +74,7 @@ void cmUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
for
(
cmTargets
::
const_iterator
l
=
tgts
.
begin
();
l
!=
tgts
.
end
();
l
++
)
{
if
(
l
->
second
.
m_
IsALibrary
)
if
(
l
->
second
.
IsALibrary
()
)
{
fout
<<
"
\\\n
lib"
<<
l
->
first
.
c_str
()
<<
"${CMAKE_LIB_EXT}"
;
}
...
...
@@ -83,7 +83,7 @@ void cmUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
for
(
cmTargets
::
const_iterator
l
=
tgts
.
begin
();
l
!=
tgts
.
end
();
l
++
)
{
if
(
!
l
->
second
.
m_
IsALibrary
)
if
(
!
l
->
second
.
IsALibrary
()
)
{
fout
<<
"
\\\n
"
<<
l
->
first
.
c_str
();
}
...
...
@@ -95,7 +95,7 @@ void cmUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
l
!=
tgts
.
end
();
l
++
)
{
std
::
vector
<
cmClassFile
>
classes
=
m_Makefile
->
GetClassesFromSourceLists
(
l
->
second
.
m_
SourceLists
);
m_Makefile
->
GetClassesFromSourceLists
(
l
->
second
.
Get
SourceLists
()
);
fout
<<
l
->
first
<<
"_SRC_OBJS = "
;
for
(
std
::
vector
<
cmClassFile
>::
iterator
i
=
classes
.
begin
();
i
!=
classes
.
end
();
i
++
)
...
...
@@ -174,7 +174,7 @@ void cmUnixMakefileGenerator::OutputTargets(std::ostream& fout)
for
(
cmTargets
::
const_iterator
l
=
tgts
.
begin
();
l
!=
tgts
.
end
();
l
++
)
{
if
(
l
->
second
.
m_
IsALibrary
)
if
(
l
->
second
.
IsALibrary
()
)
{
fout
<<
"#---------------------------------------------------------
\n
"
;
fout
<<
"# rules for a library
\n
"
;
...
...
@@ -432,11 +432,11 @@ void cmUnixMakefileGenerator::OutputCustomRules(std::ostream& fout)
{
// add any custom rules to the source groups
for
(
std
::
vector
<
cmCustomCommand
>::
const_iterator
cr
=
tgt
->
second
.
m_
CustomCommands
.
begin
();
cr
!=
tgt
->
second
.
m_
CustomCommands
.
end
();
++
cr
)
tgt
->
second
.
Get
CustomCommands
()
.
begin
();
cr
!=
tgt
->
second
.
Get
CustomCommands
()
.
end
();
++
cr
)
{
cmSourceGroup
&
sourceGroup
=
m_Makefile
->
FindSourceGroup
(
cr
->
m_
Source
.
c_str
(),
m_Makefile
->
FindSourceGroup
(
cr
->
Get
Source
Name
()
.
c_str
(),
sourceGroups
);
cmCustomCommand
cc
(
*
cr
);
cc
.
ExpandVariables
(
*
m_Makefile
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment