mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 21:59:54 -06:00
Merge topic 'policy-cmp0111-iface' into release-3.19
54ef732b0ccmVisualStudio10TargetGenerator: Avoid GetFullPath on INTERFACE libraryf06f4b517ccmTarget: Do not enforce CMP0111 on imported INTERFACE libraries43c95df8fbTests: Match RunCMake.CMP0111 stderr more strictly Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5530
This commit is contained in:
@@ -2045,35 +2045,37 @@ std::string cmTarget::ImportedGetFullPath(
|
||||
}
|
||||
|
||||
if (result.empty()) {
|
||||
auto message = [&]() -> std::string {
|
||||
std::string unset;
|
||||
std::string configuration;
|
||||
if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
|
||||
auto message = [&]() -> std::string {
|
||||
std::string unset;
|
||||
std::string configuration;
|
||||
|
||||
if (artifact == cmStateEnums::RuntimeBinaryArtifact) {
|
||||
unset = "IMPORTED_LOCATION";
|
||||
} else if (artifact == cmStateEnums::ImportLibraryArtifact) {
|
||||
unset = "IMPORTED_IMPLIB";
|
||||
if (artifact == cmStateEnums::RuntimeBinaryArtifact) {
|
||||
unset = "IMPORTED_LOCATION";
|
||||
} else if (artifact == cmStateEnums::ImportLibraryArtifact) {
|
||||
unset = "IMPORTED_IMPLIB";
|
||||
}
|
||||
|
||||
if (!config.empty()) {
|
||||
configuration = cmStrCat(" configuration \"", config, "\"");
|
||||
}
|
||||
|
||||
return cmStrCat(unset, " not set for imported target \"",
|
||||
this->GetName(), "\"", configuration, ".");
|
||||
};
|
||||
|
||||
switch (this->GetPolicyStatus(cmPolicies::CMP0111)) {
|
||||
case cmPolicies::WARN:
|
||||
impl->Makefile->IssueMessage(
|
||||
MessageType::AUTHOR_WARNING,
|
||||
cmPolicies::GetPolicyWarning(cmPolicies::CMP0111) + "\n" +
|
||||
message());
|
||||
CM_FALLTHROUGH;
|
||||
case cmPolicies::OLD:
|
||||
break;
|
||||
default:
|
||||
impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, message());
|
||||
}
|
||||
|
||||
if (!config.empty()) {
|
||||
configuration = cmStrCat(" configuration \"", config, "\"");
|
||||
}
|
||||
|
||||
return cmStrCat(unset, " not set for imported target \"",
|
||||
this->GetName(), "\"", configuration, ".");
|
||||
};
|
||||
|
||||
switch (this->GetPolicyStatus(cmPolicies::CMP0111)) {
|
||||
case cmPolicies::WARN:
|
||||
impl->Makefile->IssueMessage(
|
||||
MessageType::AUTHOR_WARNING,
|
||||
cmPolicies::GetPolicyWarning(cmPolicies::CMP0111) + "\n" +
|
||||
message());
|
||||
CM_FALLTHROUGH;
|
||||
case cmPolicies::OLD:
|
||||
break;
|
||||
default:
|
||||
impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, message());
|
||||
}
|
||||
|
||||
result = cmStrCat(this->GetName(), "-NOTFOUND");
|
||||
|
||||
@@ -3944,7 +3944,8 @@ void cmVisualStudio10TargetGenerator::AddLibraries(
|
||||
if (managedType != cmGeneratorTarget::ManagedType::Native &&
|
||||
this->GeneratorTarget->GetManagedType(config) !=
|
||||
cmGeneratorTarget::ManagedType::Native &&
|
||||
l.Target->IsImported()) {
|
||||
l.Target->IsImported() &&
|
||||
l.Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
|
||||
auto location = l.Target->GetFullPath(config);
|
||||
if (!location.empty()) {
|
||||
ConvertToWindowsSlash(location);
|
||||
|
||||
@@ -4,6 +4,7 @@ set(CMAKE_IMPORT_LIBRARY_SUFFIX "placeholder")
|
||||
add_library(unknown_lib UNKNOWN IMPORTED)
|
||||
add_library(static_lib STATIC IMPORTED)
|
||||
add_library(shared_lib SHARED IMPORTED)
|
||||
add_library(interface_lib INTERFACE IMPORTED)
|
||||
|
||||
add_executable(executable main.cpp)
|
||||
target_link_libraries(executable unknown_lib static_lib shared_lib)
|
||||
add_library(module MODULE module.cpp)
|
||||
target_link_libraries(module unknown_lib static_lib shared_lib interface_lib)
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
^CMake Error in CMakeLists.txt:
|
||||
IMPORTED_LOCATION not set for imported target "unknown_lib"( configuration
|
||||
"[^"]+")?.
|
||||
+
|
||||
CMake Error in CMakeLists.txt:
|
||||
IMPORTED_LOCATION not set for imported target "static_lib"( configuration
|
||||
".+")?.
|
||||
"[^"]+")?.
|
||||
+
|
||||
CMake Error in CMakeLists.txt:
|
||||
IMPORTED_IMPLIB not set for imported target "shared_lib"( configuration
|
||||
".+")?.
|
||||
"[^"]+")?.(
|
||||
+
|
||||
CMake Error in CMakeLists.txt:
|
||||
IMPORTED_(LOCATION|IMPLIB) not set for imported target "(unknown|static|shared)_lib"( configuration
|
||||
"[^"]+")?.)*
|
||||
+
|
||||
CMake Generate step failed. Build files cannot be regenerated correctly.$
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
CMake Warning \(dev\) in CMakeLists.txt:
|
||||
^CMake Warning \(dev\) in CMakeLists.txt:
|
||||
Policy CMP0111 is not set: An imported target missing its location property
|
||||
fails during generation. Run "cmake --help-policy CMP0111" for policy
|
||||
details. Use the cmake_policy command to set the policy and suppress this
|
||||
warning.
|
||||
|
||||
IMPORTED_LOCATION not set for imported target "unknown_lib"( configuration
|
||||
".+")?.
|
||||
"[^"]+")?.
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||
+
|
||||
CMake Warning \(dev\) in CMakeLists.txt:
|
||||
@@ -15,7 +15,7 @@ CMake Warning \(dev\) in CMakeLists.txt:
|
||||
warning.
|
||||
|
||||
IMPORTED_LOCATION not set for imported target "static_lib"( configuration
|
||||
".+")?.
|
||||
"[^"]+")?.
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||
+
|
||||
CMake Warning \(dev\) in CMakeLists.txt:
|
||||
@@ -25,5 +25,15 @@ CMake Warning \(dev\) in CMakeLists.txt:
|
||||
warning.
|
||||
|
||||
IMPORTED_IMPLIB not set for imported target "shared_lib"( configuration
|
||||
".+")?.
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||
"[^"]+")?.
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.(
|
||||
+
|
||||
CMake Warning \(dev\) in CMakeLists.txt:
|
||||
Policy CMP0111 is not set: An imported target missing its location property
|
||||
fails during generation. Run "cmake --help-policy CMP0111" for policy
|
||||
details. Use the cmake_policy command to set the policy and suppress this
|
||||
warning.
|
||||
|
||||
IMPORTED_(LOCATION|IMPLIB) not set for imported target "(unknown|static|shared)_lib"( configuration
|
||||
"[^"]+")?.
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.)*$
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
int main()
|
||||
{
|
||||
}
|
||||
4
Tests/RunCMake/CMP0111/module.cpp
Normal file
4
Tests/RunCMake/CMP0111/module.cpp
Normal file
@@ -0,0 +1,4 @@
|
||||
int module()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user