Skip to content
GitLab
Menu
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
17ab8e33
Commit
17ab8e33
authored
Oct 07, 2016
by
Stephen Kelly
Browse files
cmMakefile: Inline method into only remaining caller
parent
7edfcd0e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Source/cmCPluginAPI.cxx
View file @
17ab8e33
...
...
@@ -337,6 +337,35 @@ void CCONV cmAddCustomCommandToTarget(void* arg, const char* target,
cctype
,
no_comment
,
no_working_dir
);
}
static
void
addLinkLibrary
(
cmMakefile
*
mf
,
std
::
string
const
&
target
,
std
::
string
const
&
lib
,
cmTargetLinkLibraryType
llt
)
{
cmTarget
*
t
=
mf
->
FindLocalNonAliasTarget
(
target
);
if
(
!
t
)
{
std
::
ostringstream
e
;
e
<<
"Attempt to add link library
\"
"
<<
lib
<<
"
\"
to target
\"
"
<<
target
<<
"
\"
which is not built in this directory."
;
mf
->
IssueMessage
(
cmake
::
FATAL_ERROR
,
e
.
str
());
return
;
}
cmTarget
*
tgt
=
mf
->
GetGlobalGenerator
()
->
FindTarget
(
lib
);
if
(
tgt
&&
(
tgt
->
GetType
()
!=
cmState
::
STATIC_LIBRARY
)
&&
(
tgt
->
GetType
()
!=
cmState
::
SHARED_LIBRARY
)
&&
(
tgt
->
GetType
()
!=
cmState
::
INTERFACE_LIBRARY
)
&&
!
tgt
->
IsExecutableWithExports
())
{
std
::
ostringstream
e
;
e
<<
"Target
\"
"
<<
lib
<<
"
\"
of type "
<<
cmState
::
GetTargetTypeName
(
tgt
->
GetType
())
<<
" may not be linked into another target. "
<<
"One may link only to STATIC or SHARED libraries, or "
<<
"to executables with the ENABLE_EXPORTS property set."
;
mf
->
IssueMessage
(
cmake
::
FATAL_ERROR
,
e
.
str
());
}
t
->
AddLinkLibrary
(
*
mf
,
lib
,
llt
);
}
void
CCONV
cmAddLinkLibraryForTarget
(
void
*
arg
,
const
char
*
tgt
,
const
char
*
value
,
int
libtype
)
{
...
...
@@ -344,13 +373,13 @@ void CCONV cmAddLinkLibraryForTarget(void* arg, const char* tgt,
switch
(
libtype
)
{
case
CM_LIBRARY_GENERAL
:
mf
->
A
ddLinkLibrary
ForTarget
(
tgt
,
value
,
GENERAL_LibraryType
);
a
ddLinkLibrary
(
mf
,
tgt
,
value
,
GENERAL_LibraryType
);
break
;
case
CM_LIBRARY_DEBUG
:
mf
->
A
ddLinkLibrary
ForTarget
(
tgt
,
value
,
DEBUG_LibraryType
);
a
ddLinkLibrary
(
mf
,
tgt
,
value
,
DEBUG_LibraryType
);
break
;
case
CM_LIBRARY_OPTIMIZED
:
mf
->
A
ddLinkLibrary
ForTarget
(
tgt
,
value
,
OPTIMIZED_LibraryType
);
a
ddLinkLibrary
(
mf
,
tgt
,
value
,
OPTIMIZED_LibraryType
);
break
;
}
}
...
...
Source/cmMakefile.cxx
View file @
17ab8e33
...
...
@@ -1216,35 +1216,6 @@ void cmMakefile::AddLinkLibrary(const std::string& lib,
this
->
LinkLibraries
.
push_back
(
tmp
);
}
void
cmMakefile
::
AddLinkLibraryForTarget
(
const
std
::
string
&
target
,
const
std
::
string
&
lib
,
cmTargetLinkLibraryType
llt
)
{
cmTarget
*
t
=
this
->
FindLocalNonAliasTarget
(
target
);
if
(
!
t
)
{
std
::
ostringstream
e
;
e
<<
"Attempt to add link library
\"
"
<<
lib
<<
"
\"
to target
\"
"
<<
target
<<
"
\"
which is not built in this directory."
;
this
->
IssueMessage
(
cmake
::
FATAL_ERROR
,
e
.
str
());
return
;
}
cmTarget
*
tgt
=
this
->
GetGlobalGenerator
()
->
FindTarget
(
lib
);
if
(
tgt
&&
(
tgt
->
GetType
()
!=
cmState
::
STATIC_LIBRARY
)
&&
(
tgt
->
GetType
()
!=
cmState
::
SHARED_LIBRARY
)
&&
(
tgt
->
GetType
()
!=
cmState
::
INTERFACE_LIBRARY
)
&&
!
tgt
->
IsExecutableWithExports
())
{
std
::
ostringstream
e
;
e
<<
"Target
\"
"
<<
lib
<<
"
\"
of type "
<<
cmState
::
GetTargetTypeName
(
tgt
->
GetType
())
<<
" may not be linked into another target. "
<<
"One may link only to STATIC or SHARED libraries, or "
<<
"to executables with the ENABLE_EXPORTS property set."
;
this
->
IssueMessage
(
cmake
::
FATAL_ERROR
,
e
.
str
());
}
t
->
AddLinkLibrary
(
*
this
,
lib
,
llt
);
}
void
cmMakefile
::
InitializeFromParent
(
cmMakefile
*
parent
)
{
this
->
SystemIncludeDirectories
=
parent
->
SystemIncludeDirectories
;
...
...
Source/cmMakefile.h
View file @
17ab8e33
...
...
@@ -200,8 +200,6 @@ public:
* Add a link library to the build.
*/
void
AddLinkLibrary
(
const
std
::
string
&
,
cmTargetLinkLibraryType
type
);
void
AddLinkLibraryForTarget
(
const
std
::
string
&
tgt
,
const
std
::
string
&
,
cmTargetLinkLibraryType
type
);
/**
* Add a subdirectory to the build.
...
...
Brad King
@brad.king
Mentioned in commit
1e6aaefd
·
Oct 10, 2016
Mentioned in commit
1e6aaefd
Mentioned in commit 1e6aaefdeebbf09eaf7fa0e9dbc6a7faa2f9132a
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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