mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-08 06:40:48 -06:00
@@ -9,6 +9,7 @@
|
||||
#include "cmGlobalGenerator.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmMessageType.h"
|
||||
#include "cmPolicies.h"
|
||||
#include "cmState.h"
|
||||
#include "cmStateTypes.h"
|
||||
#include "cmStringAlgorithms.h"
|
||||
@@ -181,6 +182,16 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mf.GetPolicyStatus(cmPolicies::CMP0107) == cmPolicies::NEW) {
|
||||
// Make sure the target does not already exist.
|
||||
if (mf.FindTargetToUse(libName)) {
|
||||
status.SetError(cmStrCat(
|
||||
"cannot create ALIAS target \"", libName,
|
||||
"\" because another target with the same name already exists."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
std::string const& aliasedName = *s;
|
||||
if (mf.IsAlias(aliasedName)) {
|
||||
status.SetError(cmStrCat("cannot create ALIAS target \"", libName,
|
||||
|
||||
Reference in New Issue
Block a user