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
a49751fb
Commit
a49751fb
authored
Oct 18, 2016
by
Stephen Kelly
Browse files
cmState: Move TargetType enum to separate namespace
parent
0060391d
Pipeline
#31628
passed with stage
Changes
72
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Source/cmAddExecutableCommand.cxx
View file @
a49751fb
...
...
@@ -133,8 +133,8 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
this
->
SetError
(
e
.
str
());
return
false
;
}
cmState
::
TargetType
type
=
aliasedTarget
->
GetType
();
if
(
type
!=
cmState
::
EXECUTABLE
)
{
cmState
Enums
::
TargetType
type
=
aliasedTarget
->
GetType
();
if
(
type
!=
cmState
Enums
::
EXECUTABLE
)
{
std
::
ostringstream
e
;
e
<<
"cannot create ALIAS target
\"
"
<<
exename
<<
"
\"
because target
\"
"
<<
aliasedName
<<
"
\"
is not an "
...
...
@@ -165,7 +165,7 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
}
// Create the imported target.
this
->
Makefile
->
AddImportedTarget
(
exename
,
cmState
::
EXECUTABLE
,
this
->
Makefile
->
AddImportedTarget
(
exename
,
cmState
Enums
::
EXECUTABLE
,
importGlobal
);
return
true
;
}
...
...
Source/cmAddLibraryCommand.cxx
View file @
a49751fb
...
...
@@ -15,10 +15,10 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
}
// Library type defaults to value of BUILD_SHARED_LIBS, if it exists,
// otherwise it defaults to static library.
cmState
::
TargetType
type
=
cmState
::
SHARED_LIBRARY
;
cmState
Enums
::
TargetType
type
=
cmState
Enums
::
SHARED_LIBRARY
;
if
(
cmSystemTools
::
IsOff
(
this
->
Makefile
->
GetDefinition
(
"BUILD_SHARED_LIBS"
)))
{
type
=
cmState
::
STATIC_LIBRARY
;
type
=
cmState
Enums
::
STATIC_LIBRARY
;
}
bool
excludeFromAll
=
false
;
bool
importTarget
=
false
;
...
...
@@ -38,57 +38,57 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
while
(
s
!=
args
.
end
())
{
std
::
string
libType
=
*
s
;
if
(
libType
==
"STATIC"
)
{
if
(
type
==
cmState
::
INTERFACE_LIBRARY
)
{
if
(
type
==
cmState
Enums
::
INTERFACE_LIBRARY
)
{
std
::
ostringstream
e
;
e
<<
"INTERFACE library specified with conflicting STATIC type."
;
this
->
SetError
(
e
.
str
());
return
false
;
}
++
s
;
type
=
cmState
::
STATIC_LIBRARY
;
type
=
cmState
Enums
::
STATIC_LIBRARY
;
haveSpecifiedType
=
true
;
}
else
if
(
libType
==
"SHARED"
)
{
if
(
type
==
cmState
::
INTERFACE_LIBRARY
)
{
if
(
type
==
cmState
Enums
::
INTERFACE_LIBRARY
)
{
std
::
ostringstream
e
;
e
<<
"INTERFACE library specified with conflicting SHARED type."
;
this
->
SetError
(
e
.
str
());
return
false
;
}
++
s
;
type
=
cmState
::
SHARED_LIBRARY
;
type
=
cmState
Enums
::
SHARED_LIBRARY
;
haveSpecifiedType
=
true
;
}
else
if
(
libType
==
"MODULE"
)
{
if
(
type
==
cmState
::
INTERFACE_LIBRARY
)
{
if
(
type
==
cmState
Enums
::
INTERFACE_LIBRARY
)
{
std
::
ostringstream
e
;
e
<<
"INTERFACE library specified with conflicting MODULE type."
;
this
->
SetError
(
e
.
str
());
return
false
;
}
++
s
;
type
=
cmState
::
MODULE_LIBRARY
;
type
=
cmState
Enums
::
MODULE_LIBRARY
;
haveSpecifiedType
=
true
;
}
else
if
(
libType
==
"OBJECT"
)
{
if
(
type
==
cmState
::
INTERFACE_LIBRARY
)
{
if
(
type
==
cmState
Enums
::
INTERFACE_LIBRARY
)
{
std
::
ostringstream
e
;
e
<<
"INTERFACE library specified with conflicting OBJECT type."
;
this
->
SetError
(
e
.
str
());
return
false
;
}
++
s
;
type
=
cmState
::
OBJECT_LIBRARY
;
type
=
cmState
Enums
::
OBJECT_LIBRARY
;
haveSpecifiedType
=
true
;
}
else
if
(
libType
==
"UNKNOWN"
)
{
if
(
type
==
cmState
::
INTERFACE_LIBRARY
)
{
if
(
type
==
cmState
Enums
::
INTERFACE_LIBRARY
)
{
std
::
ostringstream
e
;
e
<<
"INTERFACE library specified with conflicting UNKNOWN type."
;
this
->
SetError
(
e
.
str
());
return
false
;
}
++
s
;
type
=
cmState
::
UNKNOWN_LIBRARY
;
type
=
cmState
Enums
::
UNKNOWN_LIBRARY
;
haveSpecifiedType
=
true
;
}
else
if
(
libType
==
"ALIAS"
)
{
if
(
type
==
cmState
::
INTERFACE_LIBRARY
)
{
if
(
type
==
cmState
Enums
::
INTERFACE_LIBRARY
)
{
std
::
ostringstream
e
;
e
<<
"INTERFACE library specified with conflicting ALIAS type."
;
this
->
SetError
(
e
.
str
());
...
...
@@ -116,10 +116,10 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
return
false
;
}
++
s
;
type
=
cmState
::
INTERFACE_LIBRARY
;
type
=
cmState
Enums
::
INTERFACE_LIBRARY
;
haveSpecifiedType
=
true
;
}
else
if
(
*
s
==
"EXCLUDE_FROM_ALL"
)
{
if
(
type
==
cmState
::
INTERFACE_LIBRARY
)
{
if
(
type
==
cmState
Enums
::
INTERFACE_LIBRARY
)
{
std
::
ostringstream
e
;
e
<<
"INTERFACE library may not be used with EXCLUDE_FROM_ALL."
;
this
->
SetError
(
e
.
str
());
...
...
@@ -133,7 +133,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
}
else
if
(
importTarget
&&
*
s
==
"GLOBAL"
)
{
++
s
;
importGlobal
=
true
;
}
else
if
(
type
==
cmState
::
INTERFACE_LIBRARY
&&
*
s
==
"GLOBAL"
)
{
}
else
if
(
type
==
cmState
Enums
::
INTERFACE_LIBRARY
&&
*
s
==
"GLOBAL"
)
{
std
::
ostringstream
e
;
e
<<
"GLOBAL option may only be used with IMPORTED libraries."
;
this
->
SetError
(
e
.
str
());
...
...
@@ -143,7 +143,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
}
}
if
(
type
==
cmState
::
INTERFACE_LIBRARY
)
{
if
(
type
==
cmState
Enums
::
INTERFACE_LIBRARY
)
{
if
(
s
!=
args
.
end
())
{
std
::
ostringstream
e
;
e
<<
"INTERFACE library requires no source arguments."
;
...
...
@@ -170,7 +170,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
bool
issueMessage
=
false
;
switch
(
this
->
Makefile
->
GetPolicyStatus
(
cmPolicies
::
CMP0037
))
{
case
cmPolicies
::
WARN
:
if
(
type
!=
cmState
::
INTERFACE_LIBRARY
)
{
if
(
type
!=
cmState
Enums
::
INTERFACE_LIBRARY
)
{
e
<<
cmPolicies
::
GetPolicyWarning
(
cmPolicies
::
CMP0037
)
<<
"
\n
"
;
issueMessage
=
true
;
}
...
...
@@ -233,12 +233,12 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
this
->
SetError
(
e
.
str
());
return
false
;
}
cmState
::
TargetType
aliasedType
=
aliasedTarget
->
GetType
();
if
(
aliasedType
!=
cmState
::
SHARED_LIBRARY
&&
aliasedType
!=
cmState
::
STATIC_LIBRARY
&&
aliasedType
!=
cmState
::
MODULE_LIBRARY
&&
aliasedType
!=
cmState
::
OBJECT_LIBRARY
&&
aliasedType
!=
cmState
::
INTERFACE_LIBRARY
)
{
cmState
Enums
::
TargetType
aliasedType
=
aliasedTarget
->
GetType
();
if
(
aliasedType
!=
cmState
Enums
::
SHARED_LIBRARY
&&
aliasedType
!=
cmState
Enums
::
STATIC_LIBRARY
&&
aliasedType
!=
cmState
Enums
::
MODULE_LIBRARY
&&
aliasedType
!=
cmState
Enums
::
OBJECT_LIBRARY
&&
aliasedType
!=
cmState
Enums
::
INTERFACE_LIBRARY
)
{
std
::
ostringstream
e
;
e
<<
"cannot create ALIAS target
\"
"
<<
libName
<<
"
\"
because target
\"
"
<<
aliasedName
<<
"
\"
is not a library."
;
...
...
@@ -265,16 +265,17 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
CMAKE_${LANG}_CREATE_SHARED_LIBRARY is defined and if not default to
STATIC. But at this point we know only the name of the target, but not
yet its linker language. */
if
((
type
==
cmState
::
SHARED_LIBRARY
||
type
==
cmState
::
MODULE_LIBRARY
)
&&
if
((
type
==
cmStateEnums
::
SHARED_LIBRARY
||
type
==
cmStateEnums
::
MODULE_LIBRARY
)
&&
(
this
->
Makefile
->
GetState
()
->
GetGlobalPropertyAsBool
(
"TARGET_SUPPORTS_SHARED_LIBS"
)
==
false
))
{
std
::
ostringstream
w
;
w
<<
"ADD_LIBRARY called with "
<<
(
type
==
cmState
::
SHARED_LIBRARY
?
"SHARED"
:
"MODULE"
)
<<
(
type
==
cmState
Enums
::
SHARED_LIBRARY
?
"SHARED"
:
"MODULE"
)
<<
" option but the target platform does not support dynamic linking. "
"Building a STATIC library instead. This may lead to problems."
;
this
->
Makefile
->
IssueMessage
(
cmake
::
AUTHOR_WARNING
,
w
.
str
());
type
=
cmState
::
STATIC_LIBRARY
;
type
=
cmState
Enums
::
STATIC_LIBRARY
;
}
// Handle imported target creation.
...
...
@@ -284,13 +285,13 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
this
->
SetError
(
"called with IMPORTED argument but no library type."
);
return
false
;
}
if
(
type
==
cmState
::
OBJECT_LIBRARY
)
{
if
(
type
==
cmState
Enums
::
OBJECT_LIBRARY
)
{
this
->
Makefile
->
IssueMessage
(
cmake
::
FATAL_ERROR
,
"The OBJECT library type may not be used for IMPORTED libraries."
);
return
true
;
}
if
(
type
==
cmState
::
INTERFACE_LIBRARY
)
{
if
(
type
==
cmState
Enums
::
INTERFACE_LIBRARY
)
{
if
(
!
cmGeneratorExpression
::
IsValidTargetName
(
libName
))
{
std
::
ostringstream
e
;
e
<<
"Invalid name for IMPORTED INTERFACE library target: "
<<
libName
;
...
...
@@ -314,7 +315,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
}
// A non-imported target may not have UNKNOWN type.
if
(
type
==
cmState
::
UNKNOWN_LIBRARY
)
{
if
(
type
==
cmState
Enums
::
UNKNOWN_LIBRARY
)
{
this
->
Makefile
->
IssueMessage
(
cmake
::
FATAL_ERROR
,
"The UNKNOWN library type may be used only for IMPORTED libraries."
);
...
...
@@ -332,7 +333,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
std
::
vector
<
std
::
string
>
srclists
;
if
(
type
==
cmState
::
INTERFACE_LIBRARY
)
{
if
(
type
==
cmState
Enums
::
INTERFACE_LIBRARY
)
{
if
(
!
cmGeneratorExpression
::
IsValidTargetName
(
libName
)
||
libName
.
find
(
"::"
)
!=
std
::
string
::
npos
)
{
std
::
ostringstream
e
;
...
...
Source/cmCPluginAPI.cxx
View file @
a49751fb
...
...
@@ -350,9 +350,9 @@ static void addLinkLibrary(cmMakefile* mf, std::string const& target,
}
cmTarget
*
tgt
=
mf
->
GetGlobalGenerator
()
->
FindTarget
(
lib
);
if
(
tgt
&&
(
tgt
->
GetType
()
!=
cmState
::
STATIC_LIBRARY
)
&&
(
tgt
->
GetType
()
!=
cmState
::
SHARED_LIBRARY
)
&&
(
tgt
->
GetType
()
!=
cmState
::
INTERFACE_LIBRARY
)
&&
if
(
tgt
&&
(
tgt
->
GetType
()
!=
cmState
Enums
::
STATIC_LIBRARY
)
&&
(
tgt
->
GetType
()
!=
cmState
Enums
::
SHARED_LIBRARY
)
&&
(
tgt
->
GetType
()
!=
cmState
Enums
::
INTERFACE_LIBRARY
)
&&
!
tgt
->
IsExecutableWithExports
())
{
std
::
ostringstream
e
;
e
<<
"Target
\"
"
<<
lib
<<
"
\"
of type "
...
...
@@ -393,8 +393,8 @@ void CCONV cmAddLibrary(void* arg, const char* libname, int shared,
for
(
i
=
0
;
i
<
numSrcs
;
++
i
)
{
srcs2
.
push_back
(
srcs
[
i
]);
}
mf
->
AddLibrary
(
libname
,
(
shared
?
cmState
::
SHARED_LIBRARY
:
cmState
::
STATIC_LIBRARY
),
mf
->
AddLibrary
(
libname
,
(
shared
?
cmStateEnums
::
SHARED_LIBRARY
:
cmState
Enums
::
STATIC_LIBRARY
),
srcs2
);
}
...
...
Source/cmCommonTargetGenerator.cxx
View file @
a49751fb
...
...
@@ -171,7 +171,7 @@ std::vector<std::string> cmCommonTargetGenerator::GetLinkedTargetDirectories()
// We can ignore the INTERFACE_LIBRARY items because
// Target->GetLinkInformation already processed their
// link interface and they don't have any output themselves.
&&
linkee
->
GetType
()
!=
cmState
::
INTERFACE_LIBRARY
&&
&&
linkee
->
GetType
()
!=
cmState
Enums
::
INTERFACE_LIBRARY
&&
emitted
.
insert
(
linkee
).
second
)
{
cmLocalGenerator
*
lg
=
linkee
->
GetLocalGenerator
();
std
::
string
di
=
lg
->
GetCurrentBinaryDirectory
();
...
...
Source/cmComputeLinkDepends.cxx
View file @
a49751fb
...
...
@@ -262,7 +262,7 @@ cmComputeLinkDepends::Compute()
LinkEntry
const
&
e
=
this
->
EntryList
[
i
];
cmGeneratorTarget
const
*
t
=
e
.
Target
;
// Entries that we know the linker will re-use do not need to be repeated.
bool
uniquify
=
t
&&
t
->
GetType
()
==
cmState
::
SHARED_LIBRARY
;
bool
uniquify
=
t
&&
t
->
GetType
()
==
cmState
Enums
::
SHARED_LIBRARY
;
if
(
!
uniquify
||
emmitted
.
insert
(
i
).
second
)
{
this
->
FinalLinkEntries
.
push_back
(
e
);
}
...
...
@@ -345,7 +345,7 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe)
if
(
cmLinkInterface
const
*
iface
=
entry
.
Target
->
GetLinkInterface
(
this
->
Config
,
this
->
Target
))
{
const
bool
isIface
=
entry
.
Target
->
GetType
()
==
cmState
::
INTERFACE_LIBRARY
;
entry
.
Target
->
GetType
()
==
cmState
Enums
::
INTERFACE_LIBRARY
;
// This target provides its own link interface information.
this
->
AddLinkEntries
(
depender_index
,
iface
->
Libraries
);
...
...
Source/cmComputeLinkInformation.cxx
View file @
a49751fb
...
...
@@ -282,7 +282,7 @@ cmComputeLinkInformation::cmComputeLinkInformation(
// the program that will load it.
this
->
LoaderFlag
=
CM_NULLPTR
;
if
(
!
this
->
UseImportLibrary
&&
this
->
Target
->
GetType
()
==
cmState
::
MODULE_LIBRARY
)
{
this
->
Target
->
GetType
()
==
cmState
Enums
::
MODULE_LIBRARY
)
{
std
::
string
loader_flag_var
=
"CMAKE_SHARED_MODULE_LOADER_"
;
loader_flag_var
+=
this
->
LinkLanguage
;
loader_flag_var
+=
"_FLAG"
;
...
...
@@ -299,10 +299,10 @@ cmComputeLinkInformation::cmComputeLinkInformation(
// Get options needed to specify RPATHs.
this
->
RuntimeUseChrpath
=
false
;
if
(
this
->
Target
->
GetType
()
!=
cmState
::
STATIC_LIBRARY
)
{
const
char
*
tType
=
((
this
->
Target
->
GetType
()
==
cmState
::
EXECUTABLE
)
?
"EXECUTABLE"
:
"SHARED_LIBRARY"
);
if
(
this
->
Target
->
GetType
()
!=
cmState
Enums
::
STATIC_LIBRARY
)
{
const
char
*
tType
=
((
this
->
Target
->
GetType
()
==
cmStateEnums
::
EXECUTABLE
)
?
"EXECUTABLE"
:
"SHARED_LIBRARY"
);
std
::
string
rtVar
=
"CMAKE_"
;
rtVar
+=
tType
;
rtVar
+=
"_RUNTIME_"
;
...
...
@@ -446,10 +446,10 @@ cmComputeLinkInformation::GetSharedLibrariesLinked()
bool
cmComputeLinkInformation
::
Compute
()
{
// Skip targets that do not link.
if
(
!
(
this
->
Target
->
GetType
()
==
cmState
::
EXECUTABLE
||
this
->
Target
->
GetType
()
==
cmState
::
SHARED_LIBRARY
||
this
->
Target
->
GetType
()
==
cmState
::
MODULE_LIBRARY
||
this
->
Target
->
GetType
()
==
cmState
::
STATIC_LIBRARY
))
{
if
(
!
(
this
->
Target
->
GetType
()
==
cmState
Enums
::
EXECUTABLE
||
this
->
Target
->
GetType
()
==
cmState
Enums
::
SHARED_LIBRARY
||
this
->
Target
->
GetType
()
==
cmState
Enums
::
MODULE_LIBRARY
||
this
->
Target
->
GetType
()
==
cmState
Enums
::
STATIC_LIBRARY
))
{
return
false
;
}
...
...
@@ -498,7 +498,7 @@ bool cmComputeLinkInformation::Compute()
i
!=
wrongItems
.
end
();
++
i
)
{
cmGeneratorTarget
const
*
tgt
=
*
i
;
bool
implib
=
(
this
->
UseImportLibrary
&&
(
tgt
->
GetType
()
==
cmState
::
SHARED_LIBRARY
));
(
tgt
->
GetType
()
==
cmState
Enums
::
SHARED_LIBRARY
));
std
::
string
lib
=
tgt
->
GetFullPath
(
this
->
Config
,
implib
,
true
);
this
->
OldLinkDirItems
.
push_back
(
lib
);
}
...
...
@@ -600,20 +600,21 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
linkItem
+=
exe
;
this
->
Items
.
push_back
(
Item
(
linkItem
,
true
,
tgt
));
this
->
Depends
.
push_back
(
exe
);
}
else
if
(
tgt
->
GetType
()
==
cmState
::
INTERFACE_LIBRARY
)
{
}
else
if
(
tgt
->
GetType
()
==
cmState
Enums
::
INTERFACE_LIBRARY
)
{
// Add the interface library as an item so it can be considered as part
// of COMPATIBLE_INTERFACE_ enforcement. The generators will ignore
// this for the actual link line.
this
->
Items
.
push_back
(
Item
(
std
::
string
(),
false
,
tgt
));
}
else
{
// Decide whether to use an import library.
bool
implib
=
(
this
->
UseImportLibrary
&&
(
impexe
||
tgt
->
GetType
()
==
cmState
::
SHARED_LIBRARY
));
bool
implib
=
(
this
->
UseImportLibrary
&&
(
impexe
||
tgt
->
GetType
()
==
cmStateEnums
::
SHARED_LIBRARY
));
// Pass the full path to the target file.
std
::
string
lib
=
tgt
->
GetFullPath
(
config
,
implib
,
true
);
if
(
!
this
->
LinkDependsNoShared
||
tgt
->
GetType
()
!=
cmState
::
SHARED_LIBRARY
)
{
tgt
->
GetType
()
!=
cmState
Enums
::
SHARED_LIBRARY
)
{
this
->
Depends
.
push_back
(
lib
);
}
...
...
@@ -652,7 +653,7 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
if
(
tgt
)
{
// The target will provide a full path. Make sure it is a shared
// library.
if
(
tgt
->
GetType
()
!=
cmState
::
SHARED_LIBRARY
)
{
if
(
tgt
->
GetType
()
!=
cmState
Enums
::
SHARED_LIBRARY
)
{
return
;
}
}
else
{
...
...
@@ -725,13 +726,13 @@ void cmComputeLinkInformation::ComputeLinkTypeInfo()
const
char
*
shared_link_type_flag
=
CM_NULLPTR
;
const
char
*
target_type_str
=
CM_NULLPTR
;
switch
(
this
->
Target
->
GetType
())
{
case
cmState
::
EXECUTABLE
:
case
cmState
Enums
::
EXECUTABLE
:
target_type_str
=
"EXE"
;
break
;
case
cmState
::
SHARED_LIBRARY
:
case
cmState
Enums
::
SHARED_LIBRARY
:
target_type_str
=
"SHARED_LIBRARY"
;
break
;
case
cmState
::
MODULE_LIBRARY
:
case
cmState
Enums
::
MODULE_LIBRARY
:
target_type_str
=
"SHARED_MODULE"
;
break
;
default:
...
...
@@ -964,12 +965,12 @@ void cmComputeLinkInformation::AddTargetItem(std::string const& item,
// shared and static libraries but static-mode can handle only
// static libraries. If a previous user item changed the link type
// to static we need to make sure it is back to shared.
if
(
target
->
GetType
()
!=
cmState
::
STATIC_LIBRARY
)
{
if
(
target
->
GetType
()
!=
cmState
Enums
::
STATIC_LIBRARY
)
{
this
->
SetCurrentLinkType
(
LinkShared
);
}
// Keep track of shared library targets linked.
if
(
target
->
GetType
()
==
cmState
::
SHARED_LIBRARY
)
{
if
(
target
->
GetType
()
==
cmState
Enums
::
SHARED_LIBRARY
)
{
this
->
SharedLibrariesLinked
.
insert
(
target
);
}
...
...
@@ -1590,13 +1591,13 @@ void cmComputeLinkInformation::AddLibraryRuntimeInfo(
// Libraries with unknown type must be handled using just the file
// on disk.
if
(
target
->
GetType
()
==
cmState
::
UNKNOWN_LIBRARY
)
{
if
(
target
->
GetType
()
==
cmState
Enums
::
UNKNOWN_LIBRARY
)
{
this
->
AddLibraryRuntimeInfo
(
fullPath
);
return
;
}
// Skip targets that are not shared libraries (modules cannot be linked).
if
(
target
->
GetType
()
!=
cmState
::
SHARED_LIBRARY
)
{
if
(
target
->
GetType
()
!=
cmState
Enums
::
SHARED_LIBRARY
)
{
return
;
}
...
...
Source/cmComputeTargetDepends.cxx
View file @
a49751fb
...
...
@@ -187,7 +187,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
{
// Get the depender.
cmGeneratorTarget
const
*
depender
=
this
->
Targets
[
depender_index
];
if
(
depender
->
GetType
()
==
cmState
::
INTERFACE_LIBRARY
)
{
if
(
depender
->
GetType
()
==
cmState
Enums
::
INTERFACE_LIBRARY
)
{
return
;
}
...
...
@@ -212,10 +212,10 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
oi
!=
objectFiles
.
end
();
++
oi
)
{
std
::
string
objLib
=
(
*
oi
)
->
GetObjectLibrary
();
if
(
!
objLib
.
empty
()
&&
emitted
.
insert
(
objLib
).
second
)
{
if
(
depender
->
GetType
()
!=
cmState
::
EXECUTABLE
&&
depender
->
GetType
()
!=
cmState
::
STATIC_LIBRARY
&&
depender
->
GetType
()
!=
cmState
::
SHARED_LIBRARY
&&
depender
->
GetType
()
!=
cmState
::
MODULE_LIBRARY
)
{
if
(
depender
->
GetType
()
!=
cmState
Enums
::
EXECUTABLE
&&
depender
->
GetType
()
!=
cmState
Enums
::
STATIC_LIBRARY
&&
depender
->
GetType
()
!=
cmState
Enums
::
SHARED_LIBRARY
&&
depender
->
GetType
()
!=
cmState
Enums
::
MODULE_LIBRARY
)
{
this
->
GlobalGenerator
->
GetCMakeInstance
()
->
IssueMessage
(
cmake
::
FATAL_ERROR
,
"Only executables and non-OBJECT libraries may "
...
...
@@ -287,7 +287,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(
// Skip targets that will not really be linked. This is probably a
// name conflict between an external library and an executable
// within the project.
if
(
dependee
&&
dependee
->
GetType
()
==
cmState
::
EXECUTABLE
&&
if
(
dependee
&&
dependee
->
GetType
()
==
cmState
Enums
::
EXECUTABLE
&&
!
dependee
->
IsExecutableWithExports
())
{
dependee
=
CM_NULLPTR
;
}
...
...
@@ -316,7 +316,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
cmGeneratorTarget
const
*
dependee
=
dependee_name
.
Target
;
if
(
!
dependee
&&
!
linking
&&
(
depender
->
GetType
()
!=
cmState
::
GLOBAL_TARGET
))
{
(
depender
->
GetType
()
!=
cmState
Enums
::
GLOBAL_TARGET
))
{
cmake
::
MessageType
messageType
=
cmake
::
AUTHOR_WARNING
;
bool
issueMessage
=
false
;
std
::
ostringstream
e
;
...
...
@@ -351,7 +351,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
// Skip targets that will not really be linked. This is probably a
// name conflict between an external library and an executable
// within the project.
if
(
linking
&&
dependee
&&
dependee
->
GetType
()
==
cmState
::
EXECUTABLE
&&
if
(
linking
&&
dependee
&&
dependee
->
GetType
()
==
cmState
Enums
::
EXECUTABLE
&&
!
dependee
->
IsExecutableWithExports
())
{
dependee
=
CM_NULLPTR
;
}
...
...
@@ -366,7 +366,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
bool
linking
)
{
if
(
dependee
->
IsImported
()
||
dependee
->
GetType
()
==
cmState
::
INTERFACE_LIBRARY
)
{
dependee
->
GetType
()
==
cmState
Enums
::
INTERFACE_LIBRARY
)
{
// Skip IMPORTED and INTERFACE targets but follow their utility
// dependencies.
std
::
set
<
cmLinkItem
>
const
&
utils
=
dependee
->
GetUtilityItems
();
...
...
@@ -452,7 +452,7 @@ bool cmComputeTargetDepends::CheckComponents(
// Make sure the component is all STATIC_LIBRARY targets.
for
(
NodeList
::
const_iterator
ni
=
nl
.
begin
();
ni
!=
nl
.
end
();
++
ni
)
{
if
(
this
->
Targets
[
*
ni
]
->
GetType
()
!=
cmState
::
STATIC_LIBRARY
)
{
if
(
this
->
Targets
[
*
ni
]
->
GetType
()
!=
cmState
Enums
::
STATIC_LIBRARY
)
{
this
->
ComplainAboutBadComponent
(
ccg
,
c
);
return
false
;
}
...
...
Source/cmCoreTryCompile.cxx
View file @
a49751fb
...
...
@@ -43,24 +43,25 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
// which signature were we called with ?
this
->
SrcFileSignature
=
true
;
cmState
::
TargetType
targetType
=
cmState
::
EXECUTABLE
;
cmState
Enums
::
TargetType
targetType
=
cmState
Enums
::
EXECUTABLE
;
const
char
*
tt
=
this
->
Makefile
->
GetDefinition
(
"CMAKE_TRY_COMPILE_TARGET_TYPE"
);
if
(
!
isTryRun
&&
tt
&&
*
tt
)
{
if
(
strcmp
(
tt
,
cmState
::
GetTargetTypeName
(
cmState
::
EXECUTABLE
))
==
0
)
{
targetType
=
cmState
::
EXECUTABLE
;
if
(
strcmp
(
tt
,
cmState
::
GetTargetTypeName
(
cmStateEnums
::
EXECUTABLE
))
==
0
)
{
targetType
=
cmStateEnums
::
EXECUTABLE
;
}
else
if
(
strcmp
(
tt
,
cmState
::
GetTargetTypeName
(
cmState
::
STATIC_LIBRARY
))
==
0
)
{
targetType
=
cmState
::
STATIC_LIBRARY
;
cmState
Enums
::
STATIC_LIBRARY
))
==
0
)
{
targetType
=
cmState
Enums
::
STATIC_LIBRARY
;
}
else
{
this
->
Makefile
->
IssueMessage
(
cmake
::
FATAL_ERROR
,
std
::
string
(
"Invalid value '"
)
+
tt
+
"' for "
"CMAKE_TRY_COMPILE_TARGET_TYPE. Only "
"'"
+
cmState
::
GetTargetTypeName
(
cmState
::
EXECUTABLE
)
+
"' and "
"'"
+
cmState
::
GetTargetTypeName
(
cmState
::
STATIC_LIBRARY
)
+
cmState
::
GetTargetTypeName
(
cmState
Enums
::
EXECUTABLE
)
+
"' and "
"'"
+
cmState
::
GetTargetTypeName
(
cmState
Enums
::
STATIC_LIBRARY
)
+
"' "
"are allowed."
);
return
-
1
;
...
...
@@ -122,12 +123,12 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
libsToLink
+=
"
\"
"
+
cmSystemTools
::
TrimWhitespace
(
argv
[
i
])
+
"
\"
"
;
if
(
cmTarget
*
tgt
=
this
->
Makefile
->
FindTargetToUse
(
argv
[
i
]))
{
switch
(
tgt
->
GetType
())
{
case
cmState
::
SHARED_LIBRARY
:
case
cmState
::
STATIC_LIBRARY
:
case
cmState
::
INTERFACE_LIBRARY
:
case
cmState
::
UNKNOWN_LIBRARY
:
case
cmState
Enums
::
SHARED_LIBRARY
:
case
cmState
Enums
::
STATIC_LIBRARY
:
case
cmState
Enums
::
INTERFACE_LIBRARY
:
case
cmState
Enums
::
UNKNOWN_LIBRARY
:
break
;
case
cmState
::
EXECUTABLE
:
case
cmState
Enums
::
EXECUTABLE
:
if
(
tgt
->
IsExecutableWithExports
())
{
break
;
}
...
...
@@ -481,13 +482,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
?
"NEW"
:
"OLD"
);
if
(
targetType
==
cmState
::
EXECUTABLE
)
{
if
(
targetType
==
cmState
Enums
::
EXECUTABLE
)
{
/* Put the executable at a known location (for COPY_FILE). */
fprintf
(
fout
,
"set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
\"
%s
\"
)
\n
"
,
this
->
BinaryDirectory
.
c_str
());
/* Create the actual executable. */
fprintf
(
fout
,
"add_executable(%s"
,
targetName
.
c_str
());
}
else
// if (targetType == cmState::STATIC_LIBRARY)
}
else
// if (targetType == cmState
Enums
::STATIC_LIBRARY)
{
/* Put the static library at a known location (for COPY_FILE). */
fprintf
(
fout
,
"set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY
\"
%s
\"
)
\n
"
,
...
...
@@ -627,16 +628,16 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir)
}
void
cmCoreTryCompile
::
FindOutputFile
(
const
std
::
string
&
targetName
,
cmState
::
TargetType
targetType
)
cmState
Enums
::
TargetType
targetType
)
{
this
->
FindErrorMessage
=
""
;
this
->
OutputFile
=
""
;
std
::
string
tmpOutputFile
=
"/"
;
if
(
targetType
==
cmState
::
EXECUTABLE
)
{
if
(
targetType
==
cmState
Enums
::
EXECUTABLE
)
{
tmpOutputFile
+=
targetName
;
tmpOutputFile
+=
this
->
Makefile
->
GetSafeDefinition
(
"CMAKE_EXECUTABLE_SUFFIX"
);
}
else
// if (targetType == cmState::STATIC_LIBRARY)
}
else
// if (targetType == cmState
Enums
::STATIC_LIBRARY)
{
tmpOutputFile
+=
this
->
Makefile
->
GetSafeDefinition
(
"CMAKE_STATIC_LIBRARY_PREFIX"
);
...
...
Source/cmCoreTryCompile.h
View file @
a49751fb
...
...
@@ -35,7 +35,7 @@ protected:
the error message is stored in FindErrorMessage.
*/
void
FindOutputFile
(
const
std
::
string
&
targetName
,
cmState
::
TargetType
targetType
);
cmState
Enums
::
TargetType
targetType
);
cmTypeMacro
(
cmCoreTryCompile
,
cmCommand
);
...
...
Source/cmCustomCommandGenerator.cxx
View file @
a49751fb
...
...
@@ -42,7 +42,7 @@ bool cmCustomCommandGenerator::UseCrossCompilingEmulator(unsigned int c) const
{
std
::
string
const
&
argv0
=
this
->
CC
.
GetCommandLines
()[
c
][
0
];
cmGeneratorTarget
*
target
=
this
->
LG
->
FindGeneratorTargetToUse
(
argv0
);
if
(
target
&&
target
->
GetType
()
==
cmState
::
EXECUTABLE
)
{
if
(
target
&&
target
->
GetType
()
==
cmState
Enums
::
EXECUTABLE
)
{
return
target
->
GetProperty
(
"CROSSCOMPILING_EMULATOR"
)
!=
CM_NULLPTR
;
}
return
false
;
...
...
@@ -52,12 +52,12 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const
{
std
::
string
const
&
argv0
=
this
->
CC
.
GetCommandLines
()[
c
][
0
];
cmGeneratorTarget
*
target
=
this
->
LG
->
FindGeneratorTargetToUse
(
argv0
);
if
(
target
&&
target
->
GetType
()
==
cmState
::
EXECUTABLE
&&
if
(
target
&&
target
->
GetType
()
==
cmState
Enums
::
EXECUTABLE
&&
(
target
->
IsImported
()
||
!
this
->
LG
->
GetMakefile
()
->
IsOn
(
"CMAKE_CROSSCOMPILING"
)))
{
return
target
->
GetLocation
(
this
->
Config
);
}
if
(
target
&&
target
->
GetType
()
==
cmState
::
EXECUTABLE
)
{
if
(
target
&&
target
->
GetType
()
==
cmState
Enums
::
EXECUTABLE
)
{
const
char
*
emulator
=
target
->
GetProperty
(
"CROSSCOMPILING_EMULATOR"
);
if
(
emulator
)
{
return
std
::
string
(
emulator
);
...
...
Source/cmExportBuildAndroidMKGenerator.cxx
View file @
a49751fb
...
...
@@ -111,8 +111,8 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
target
->
GetLocalGenerator
()
->
FindGeneratorTargetToUse
(
*
i
);
if
(
gt
)
{
if
(
gt
->
GetType
()
==
cmState
::
SHARED_LIBRARY
||
gt
->
GetType
()
==
cmState
::
MODULE_LIBRARY
)
{
if
(
gt
->
GetType
()
==
cmState
Enums
::
SHARED_LIBRARY
||
gt
->
GetType
()
==
cmState
Enums
::
MODULE_LIBRARY
)
{
sharedLibs
+=
" "
+
*
i
;
}
else
{
staticLibs
+=
" "
+
*
i
;
...
...
@@ -168,7 +168,7 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
}