fileapi: Add INTERFACE libraries with SOURCES to codemodel-v2

INTERFACE libraries with SOURCES now appear in the generated
buildsystem, so include them in the codemodel output too.

We do not need to bump the `codemodel-v2` object kind minor
version because that was already done in post-3.18 development
by commit 7d6861f367 (fileapi: Extend codemodel targets with
language standard, 2020-06-18).

Fixes: #18608
This commit is contained in:
Brad King
2020-07-20 15:30:31 -04:00
parent 4391913133
commit bafa9fe887
14 changed files with 263 additions and 3 deletions

View File

@@ -650,7 +650,8 @@ with members:
``type``
A string specifying the type of the target. The value is one of
``EXECUTABLE``, ``STATIC_LIBRARY``, ``SHARED_LIBRARY``,
``MODULE_LIBRARY``, ``OBJECT_LIBRARY``, or ``UTILITY``.
``MODULE_LIBRARY``, ``OBJECT_LIBRARY``, ``INTERFACE_LIBRARY``,
or ``UTILITY``.
``backtrace``
Optional member that is present when a CMake language backtrace to

View File

@@ -625,7 +625,7 @@ Json::Value CodemodelConfig::DumpTargets()
for (cmGeneratorTarget* gt : targetList) {
if (gt->GetType() == cmStateEnums::GLOBAL_TARGET ||
gt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
!gt->IsInBuildSystem()) {
continue;
}

View File

@@ -522,6 +522,7 @@ def gen_check_directories(c, g):
read_codemodel_json_data("directories/custom.json"),
read_codemodel_json_data("directories/cxx.json"),
read_codemodel_json_data("directories/imported.json"),
read_codemodel_json_data("directories/interface.json"),
read_codemodel_json_data("directories/object.json"),
read_codemodel_json_data("directories/dir.json"),
read_codemodel_json_data("directories/dir_dir.json"),
@@ -594,6 +595,10 @@ def gen_check_targets(c, g, inSource):
read_codemodel_json_data("targets/link_imported_object_exe.json"),
read_codemodel_json_data("targets/link_imported_interface_exe.json"),
read_codemodel_json_data("targets/all_build_interface.json"),
read_codemodel_json_data("targets/zero_check_interface.json"),
read_codemodel_json_data("targets/iface_srcs.json"),
read_codemodel_json_data("targets/all_build_custom.json"),
read_codemodel_json_data("targets/zero_check_custom.json"),
read_codemodel_json_data("targets/custom_tgt.json"),
@@ -722,6 +727,7 @@ def gen_check_projects(c, g):
read_codemodel_json_data("projects/alias.json"),
read_codemodel_json_data("projects/object.json"),
read_codemodel_json_data("projects/imported.json"),
read_codemodel_json_data("projects/interface.json"),
read_codemodel_json_data("projects/custom.json"),
read_codemodel_json_data("projects/external.json"),
]

View File

@@ -0,0 +1,14 @@
{
"source": "^interface$",
"build": "^interface$",
"parentSource": "^\\.$",
"childSources": null,
"targetIds": [
"^ALL_BUILD::@25b7fa8ea00134654b85$",
"^ZERO_CHECK::@25b7fa8ea00134654b85$",
"^iface_srcs::@25b7fa8ea00134654b85$"
],
"projectName": "Interface",
"minimumCMakeVersion": "3.12",
"hasInstallRule": null
}

View File

@@ -7,6 +7,7 @@
"^custom$",
"^cxx$",
"^imported$",
"^interface$",
"^object$",
"^.*/Tests/RunCMake/FileAPIExternalSource$",
"^dir$"

View File

@@ -6,6 +6,7 @@
"Custom",
"Cxx",
"Imported",
"Interface",
"Object",
"External"
],

View File

@@ -0,0 +1,13 @@
{
"name": "Interface",
"parentName": "codemodel-v2",
"childNames": null,
"directorySources": [
"^interface$"
],
"targetIds": [
"^ALL_BUILD::@25b7fa8ea00134654b85$",
"^ZERO_CHECK::@25b7fa8ea00134654b85$",
"^iface_srcs::@25b7fa8ea00134654b85$"
]
}

View File

@@ -0,0 +1,79 @@
{
"name": "ALL_BUILD",
"id": "^ALL_BUILD::@25b7fa8ea00134654b85$",
"directorySource": "^interface$",
"projectName": "Interface",
"type": "UTILITY",
"isGeneratorProvided": true,
"sources": [
{
"path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ALL_BUILD$",
"isGenerated": true,
"sourceGroupName": "",
"compileGroupLanguage": null,
"backtrace": [
{
"file": "^interface/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
]
},
{
"path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ALL_BUILD\\.rule$",
"isGenerated": true,
"sourceGroupName": "CMake Rules",
"compileGroupLanguage": null,
"backtrace": [
{
"file": "^interface/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
]
}
],
"sourceGroups": [
{
"name": "",
"sourcePaths": [
"^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ALL_BUILD$"
]
},
{
"name": "CMake Rules",
"sourcePaths": [
"^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ALL_BUILD\\.rule$"
]
}
],
"compileGroups": null,
"backtrace": [
{
"file": "^interface/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
],
"folder": null,
"nameOnDisk": null,
"artifacts": null,
"build": "^interface$",
"source": "^interface$",
"install": null,
"link": null,
"archive": null,
"dependencies": [
{
"id": "^ZERO_CHECK::@25b7fa8ea00134654b85$",
"backtrace": null
},
{
"id": "^iface_srcs::@25b7fa8ea00134654b85$",
"backtrace": null
}
]
}

View File

@@ -175,6 +175,10 @@
"id": "^link_imported_interface_exe::@ba7eb709d0b48779c6c8$",
"backtrace": null
},
{
"id": "^iface_srcs::@25b7fa8ea00134654b85$",
"backtrace": null
},
{
"id": "^custom_exe::@c11385ffed57b860da63$",
"backtrace": null

View File

@@ -119,7 +119,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
"line": 37,
"line": 38,
"command": "install",
"hasParent": true
},

View File

@@ -0,0 +1,67 @@
{
"name": "iface_srcs",
"id": "^iface_srcs::@25b7fa8ea00134654b85$",
"directorySource": "^interface$",
"projectName": "Interface",
"type": "INTERFACE_LIBRARY",
"isGeneratorProvided": null,
"sources": [
{
"path": "^empty\\.c$",
"isGenerated": null,
"sourceGroupName": "Source Files",
"compileGroupLanguage": null,
"backtrace": [
{
"file": "^interface/CMakeLists\\.txt$",
"line": 3,
"command": "add_library",
"hasParent": true
},
{
"file": "^interface/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
]
}
],
"sourceGroups": [
{
"name": "Source Files",
"sourcePaths": [
"^empty\\.c$"
]
}
],
"compileGroups": null,
"backtrace": [
{
"file": "^interface/CMakeLists\\.txt$",
"line": 3,
"command": "add_library",
"hasParent": true
},
{
"file": "^interface/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
],
"folder": null,
"nameOnDisk": null,
"artifacts": null,
"build": "^interface$",
"source": "^interface$",
"install": null,
"link": null,
"archive": null,
"dependencies": [
{
"id": "^ZERO_CHECK::@25b7fa8ea00134654b85$",
"backtrace": null
}
]
}

View File

@@ -0,0 +1,70 @@
{
"name": "ZERO_CHECK",
"id": "^ZERO_CHECK::@25b7fa8ea00134654b85$",
"directorySource": "^interface$",
"projectName": "Interface",
"type": "UTILITY",
"isGeneratorProvided": true,
"sources": [
{
"path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ZERO_CHECK$",
"isGenerated": true,
"sourceGroupName": "",
"compileGroupLanguage": null,
"backtrace": [
{
"file": "^interface/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
]
},
{
"path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ZERO_CHECK\\.rule$",
"isGenerated": true,
"sourceGroupName": "CMake Rules",
"compileGroupLanguage": null,
"backtrace": [
{
"file": "^interface/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
]
}
],
"sourceGroups": [
{
"name": "",
"sourcePaths": [
"^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ZERO_CHECK$"
]
},
{
"name": "CMake Rules",
"sourcePaths": [
"^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ZERO_CHECK\\.rule$"
]
}
],
"compileGroups": null,
"backtrace": [
{
"file": "^interface/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
],
"folder": null,
"nameOnDisk": null,
"artifacts": null,
"build": "^interface$",
"source": "^interface$",
"install": null,
"link": null,
"archive": null,
"dependencies": null
}

View File

@@ -18,6 +18,7 @@ add_subdirectory(cxx)
add_subdirectory(alias)
add_subdirectory(object)
add_subdirectory(imported)
add_subdirectory(interface)
add_subdirectory(custom)
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../FileAPIExternalSource" "${CMAKE_CURRENT_BINARY_DIR}/../FileAPIExternalBuild")
add_subdirectory(dir)

View File

@@ -0,0 +1,3 @@
project(Interface)
add_library(iface_none INTERFACE)
add_library(iface_srcs INTERFACE ../empty.c)