Commit 7e919ace authored by Craig Scott's avatar Craig Scott
Browse files

Merge branch 'export-properties-undefined' into release-3.12

Merge-request: !2294
parents c4ab0980 dbd3e2c5
......@@ -1143,6 +1143,11 @@ bool cmExportFileGenerator::PopulateExportProperties(
return false;
}
auto propertyValue = targetProperties.GetPropertyValue(prop);
if (propertyValue == nullptr) {
// Asked to export a property that isn't defined on the target. Do not
// consider this an error, there's just nothing to export.
continue;
}
std::string evaluatedValue = cmGeneratorExpression::Preprocess(
propertyValue, cmGeneratorExpression::StripAllGeneratorExpressions);
if (evaluatedValue != propertyValue) {
......
enable_language(CXX)
add_library(foo empty.cpp)
set_target_properties(foo PROPERTIES
EXPORT_PROPERTIES "NotDefinedProp"
)
export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake")
install(TARGETS foo EXPORT fooExport
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
......@@ -8,3 +8,4 @@ run_cmake(NoExportSet)
run_cmake(ForbiddenToExportInterfaceProperties)
run_cmake(ForbiddenToExportImportedProperties)
run_cmake(ForbiddenToExportPropertyWithGenExp)
run_cmake(ExportPropertiesUndefined)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment