1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

fileAPI: Add test coverage for interface direct and genex contexts

This commit is contained in:
Craig Scott
2025-10-04 09:34:12 +10:00
committed by Brad King
parent 53ed1e5893
commit 004d825f3e
21 changed files with 1040 additions and 24 deletions

View File

@@ -798,6 +798,7 @@ def gen_check_directories(c, g):
read_codemodel_json_data("directories/fileset.json"),
read_codemodel_json_data("directories/subdir.json"),
read_codemodel_json_data("directories/framework.json"),
read_codemodel_json_data("directories/direct.json"),
]
if matches(g["name"], "^Visual Studio "):
@@ -905,12 +906,21 @@ def gen_check_build_system_targets(c, g, inSource):
read_codemodel_json_data("targets/zero_check_interface.json"),
read_codemodel_json_data("targets/iface_srcs.json"),
read_codemodel_json_data("targets/all_build_direct.json"),
read_codemodel_json_data("targets/zero_check_direct.json"),
read_codemodel_json_data("targets/link_transitive_direct_exe.json"),
read_codemodel_json_data("targets/transitive_direct_lib.json"),
read_codemodel_json_data("targets/inject_direct_lib_impl.json"),
read_codemodel_json_data("targets/usage_lib.json"),
read_codemodel_json_data("targets/link_usage_exe.json"),
read_codemodel_json_data("targets/compile_usage_exe.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"),
read_codemodel_json_data("targets/custom_exe.json"),
read_codemodel_json_data("targets/all_build_external.json"),
read_codemodel_json_data("targets/zero_check_external.json"),
read_codemodel_json_data("targets/zero_check_external.json"), # Must be the last zero_check_... because matches all ZERO_CHECK::@XXX target ids
read_codemodel_json_data("targets/generated_exe.json"),
read_codemodel_json_data("targets/c_headers_1.json"),
@@ -1077,7 +1087,9 @@ def gen_check_abstract_targets(c, g, inSource):
read_codemodel_json_data("targets/imported_static_lib.json"),
read_codemodel_json_data("targets/iface_none.json"),
read_codemodel_json_data("targets/iface_symbolic.json")
read_codemodel_json_data("targets/iface_symbolic.json"),
read_codemodel_json_data("targets/inject_direct_lib.json"),
]
if sys.platform == "darwin":
@@ -1124,6 +1136,7 @@ def gen_check_projects(c, g):
read_codemodel_json_data("projects/custom.json"),
read_codemodel_json_data("projects/external.json"),
read_codemodel_json_data("projects/framework.json"),
read_codemodel_json_data("projects/direct.json"),
]
if matches(g["name"], "^Visual Studio "):

View File

@@ -0,0 +1,23 @@
{
"source": "^direct$",
"build": "^direct$",
"parentSource": "^\\.$",
"childSources": null,
"targetIds": [
"^ALL_BUILD::@79b6367c9e05c77f6a80$",
"^ZERO_CHECK::@79b6367c9e05c77f6a80$",
"^link_transitive_direct_exe::@79b6367c9e05c77f6a80$",
"^transitive_direct_lib::@79b6367c9e05c77f6a80$",
"^inject_direct_lib_impl::@79b6367c9e05c77f6a80$",
"^usage_lib::@79b6367c9e05c77f6a80$",
"^link_usage_exe::@79b6367c9e05c77f6a80$",
"^compile_usage_exe::@79b6367c9e05c77f6a80$"
],
"abstractTargetIds": [
"^inject_direct_lib::@79b6367c9e05c77f6a80$"
],
"projectName": "Direct",
"minimumCMakeVersion": "3.13",
"hasInstallRule": null,
"installers": []
}

View File

@@ -13,7 +13,8 @@
"^dir$",
"^fileset$",
"^subdir$",
"^framework$"
"^framework$",
"^direct$"
],
"targetIds": [
"^ALL_BUILD::@6890427a1f51a3e7e1df$",
@@ -54,7 +55,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
"line": 51,
"line": 52,
"command": "install",
"hasParent": true
},
@@ -99,7 +100,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
"line": 54,
"line": 55,
"command": "install",
"hasParent": true
},
@@ -147,7 +148,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
"line": 54,
"line": 55,
"command": "install",
"hasParent": true
},
@@ -192,7 +193,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
"line": 54,
"line": 55,
"command": "install",
"hasParent": true
},
@@ -236,7 +237,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
"line": 54,
"line": 55,
"command": "install",
"hasParent": true
},
@@ -280,7 +281,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
"line": 59,
"line": 60,
"command": "install",
"hasParent": true
},
@@ -327,7 +328,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
"line": 61,
"line": 62,
"command": "install",
"hasParent": true
},
@@ -372,7 +373,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
"line": 62,
"line": 63,
"command": "install",
"hasParent": true
},
@@ -421,7 +422,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
"line": 63,
"line": 64,
"command": "install",
"hasParent": true
},
@@ -473,7 +474,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
"line": 64,
"line": 65,
"command": "install",
"hasParent": true
},
@@ -522,7 +523,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
"line": 65,
"line": 66,
"command": "install",
"hasParent": true
},
@@ -564,7 +565,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
"line": 66,
"line": 67,
"command": "install",
"hasParent": true
},
@@ -606,7 +607,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
"line": 67,
"line": 68,
"command": "install",
"hasParent": true
},

View File

@@ -9,7 +9,8 @@
"Interface",
"Object",
"External",
"Framework"
"Framework",
"Direct"
],
"directorySources": [
"^\\.$",

View File

@@ -0,0 +1,21 @@
{
"name": "Direct",
"parentName": "codemodel-v2",
"childNames": null,
"directorySources": [
"^direct$"
],
"targetIds": [
"^ALL_BUILD::@79b6367c9e05c77f6a80$",
"^ZERO_CHECK::@79b6367c9e05c77f6a80$",
"^link_transitive_direct_exe::@79b6367c9e05c77f6a80$",
"^transitive_direct_lib::@79b6367c9e05c77f6a80$",
"^inject_direct_lib_impl::@79b6367c9e05c77f6a80$",
"^usage_lib::@79b6367c9e05c77f6a80$",
"^link_usage_exe::@79b6367c9e05c77f6a80$",
"^compile_usage_exe::@79b6367c9e05c77f6a80$"
],
"abstractTargetIds": [
"^inject_direct_lib::@79b6367c9e05c77f6a80$"
]
}

View File

@@ -0,0 +1,106 @@
{
"name": "ALL_BUILD",
"id": "^ALL_BUILD::@79b6367c9e05c77f6a80$",
"directorySource": "^direct$",
"projectName": "Direct",
"type": "UTILITY",
"imported": null,
"local": null,
"abstract": null,
"symbolic": null,
"isGeneratorProvided": true,
"fileSets": null,
"sources": [
{
"path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/direct/CMakeFiles/ALL_BUILD$",
"isGenerated": true,
"fileSetName": null,
"sourceGroupName": "",
"compileGroupLanguage": null,
"backtrace": [
{
"file": "^direct/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
]
},
{
"path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/direct/CMakeFiles/ALL_BUILD\\.rule$",
"isGenerated": true,
"fileSetName": null,
"sourceGroupName": "CMake Rules",
"compileGroupLanguage": null,
"backtrace": [
{
"file": "^direct/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
]
}
],
"sourceGroups": [
{
"name": "",
"sourcePaths": [
"^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/direct/CMakeFiles/ALL_BUILD$"
]
},
{
"name": "CMake Rules",
"sourcePaths": [
"^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/direct/CMakeFiles/ALL_BUILD\\.rule$"
]
}
],
"compileGroups": null,
"backtrace": [
{
"file": "^direct/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
],
"folder": null,
"nameOnDisk": null,
"artifacts": null,
"build": "^direct$",
"source": "^direct$",
"install": null,
"link": null,
"archive": null,
"dependencies": [
{
"id": "^ZERO_CHECK::@79b6367c9e05c77f6a80$",
"backtrace": null
},
{
"id": "^link_transitive_direct_exe::@79b6367c9e05c77f6a80$",
"backtrace": null
},
{
"id": "^transitive_direct_lib::@79b6367c9e05c77f6a80$",
"backtrace": null
},
{
"id": "^inject_direct_lib_impl::@79b6367c9e05c77f6a80$",
"backtrace": null
},
{
"id": "^usage_lib::@79b6367c9e05c77f6a80$",
"backtrace": null
},
{
"id": "^link_usage_exe::@79b6367c9e05c77f6a80$",
"backtrace": null
},
{
"id": "^compile_usage_exe::@79b6367c9e05c77f6a80$",
"backtrace": null
}
]
}

View File

@@ -237,6 +237,30 @@
{
"id": "^exe_framework::@217a96c3a62328a73ef4$",
"backtrace": null
},
{
"id": "^link_transitive_direct_exe::@79b6367c9e05c77f6a80$",
"backtrace": null
},
{
"id": "^transitive_direct_lib::@79b6367c9e05c77f6a80$",
"backtrace": null
},
{
"id": "^inject_direct_lib_impl::@79b6367c9e05c77f6a80$",
"backtrace": null
},
{
"id": "^usage_lib::@79b6367c9e05c77f6a80$",
"backtrace": null
},
{
"id": "^link_usage_exe::@79b6367c9e05c77f6a80$",
"backtrace": null
},
{
"id": "^compile_usage_exe::@79b6367c9e05c77f6a80$",
"backtrace": null
}
]
}

View File

@@ -130,7 +130,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
"line": 54,
"line": 55,
"command": "install",
"hasParent": true
},
@@ -160,7 +160,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
"line": 54,
"line": 55,
"command": "install",
"hasParent": true
},
@@ -190,7 +190,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
"line": 59,
"line": 60,
"command": "install",
"hasParent": true
},

View File

@@ -0,0 +1,102 @@
{
"name": "compile_usage_exe",
"id": "^compile_usage_exe::@79b6367c9e05c77f6a80$",
"directorySource": "^direct$",
"projectName": "Direct",
"type": "EXECUTABLE",
"imported": null,
"local": null,
"abstract": null,
"symbolic": null,
"isGeneratorProvided": null,
"fileSets": null,
"sources": [
{
"path": "^empty\\.c$",
"isGenerated": null,
"fileSetName": null,
"sourceGroupName": "Source Files",
"compileGroupLanguage": "C",
"backtrace": [
{
"file": "^direct/CMakeLists\\.txt$",
"line": 38,
"command": "add_executable",
"hasParent": true
},
{
"file": "^direct/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
]
}
],
"sourceGroups": [
{
"name": "Source Files",
"sourcePaths": [
"^empty\\.c$"
]
}
],
"compileGroups": [
{
"language": "C",
"sourcePaths": [
"^empty\\.c$"
],
"includes": null,
"frameworks": null,
"defines": [
{
"define": "_MBCS",
"backtrace": null
}
],
"compileCommandFragments": null
}
],
"backtrace": [
{
"file": "^direct/CMakeLists\\.txt$",
"line": 38,
"command": "add_executable",
"hasParent": true
},
{
"file": "^direct/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
],
"folder": null,
"nameOnDisk": "^compile_usage_exe(\\.exe)?$",
"artifacts": [
{
"path": "^direct/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?compile_usage_exe(\\.exe)?$",
"_dllExtra": false
},
{
"path": "^direct/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?compile_usage_exe\\.pdb$",
"_dllExtra": true
}
],
"build": "^direct$",
"source": "^direct$",
"install": null,
"link": {
"language": "C",
"lto": null,
"commandFragments": null
},
"archive": null,
"dependencies": [
{
"id": "^ZERO_CHECK::@79b6367c9e05c77f6a80$",
"backtrace": null
}
]
}

View File

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

View File

@@ -106,7 +106,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
"line": 54,
"line": 55,
"command": "install",
"hasParent": true
},
@@ -136,7 +136,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
"line": 54,
"line": 55,
"command": "install",
"hasParent": true
},
@@ -166,7 +166,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
"line": 59,
"line": 60,
"command": "install",
"hasParent": true
},

View File

@@ -0,0 +1,39 @@
{
"name": "inject_direct_lib",
"id": "^inject_direct_lib::@79b6367c9e05c77f6a80$",
"directorySource": "^direct$",
"projectName": "Direct",
"type": "INTERFACE_LIBRARY",
"imported": null,
"local": null,
"abstract": true,
"symbolic": null,
"isGeneratorProvided": null,
"fileSets": null,
"sources": [],
"sourceGroups": null,
"compileGroups": null,
"backtrace": [
{
"file": "^direct/CMakeLists\\.txt$",
"line": 5,
"command": "add_library",
"hasParent": true
},
{
"file": "^direct/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
],
"folder": null,
"nameOnDisk": null,
"artifacts": null,
"build": "^direct$",
"source": "^direct$",
"install": null,
"link": null,
"archive": null,
"dependencies": null
}

View File

@@ -0,0 +1,94 @@
{
"name": "inject_direct_lib_impl",
"id": "^inject_direct_lib_impl::@79b6367c9e05c77f6a80$",
"directorySource": "^direct$",
"projectName": "Direct",
"type": "OBJECT_LIBRARY",
"imported": null,
"local": null,
"abstract": null,
"symbolic": null,
"isGeneratorProvided": null,
"fileSets": null,
"sources": [
{
"path": "^direct/other\\.c$",
"isGenerated": null,
"fileSetName": null,
"sourceGroupName": "Source Files",
"compileGroupLanguage": "C",
"backtrace": [
{
"file": "^direct/CMakeLists\\.txt$",
"line": 6,
"command": "add_library",
"hasParent": true
},
{
"file": "^direct/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
]
}
],
"sourceGroups": [
{
"name": "Source Files",
"sourcePaths": [
"^direct/other\\.c$"
]
}
],
"compileGroups": [
{
"language": "C",
"sourcePaths": [
"^direct/other\\.c$"
],
"includes": null,
"frameworks": null,
"defines": [
{
"define": "_MBCS",
"backtrace": null
}
],
"compileCommandFragments": null
}
],
"backtrace": [
{
"file": "^direct/CMakeLists\\.txt$",
"line": 6,
"command": "add_library",
"hasParent": true
},
{
"file": "^direct/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
],
"folder": null,
"nameOnDisk": null,
"artifacts": [
{
"path": "^(direct|build/inject_direct_lib_impl\\.build)/.*/other(\\.c)?\\.o(bj)?$",
"_dllExtra": false
}
],
"build": "^direct$",
"source": "^direct$",
"install": null,
"link": null,
"archive": null,
"dependencies": [
{
"id": "^ZERO_CHECK::@79b6367c9e05c77f6a80$",
"backtrace": null
}
]
}

View File

@@ -0,0 +1,163 @@
{
"name": "link_transitive_direct_exe",
"id": "^link_transitive_direct_exe::@79b6367c9e05c77f6a80$",
"directorySource": "^direct$",
"projectName": "Direct",
"type": "EXECUTABLE",
"imported": null,
"local": null,
"abstract": null,
"symbolic": null,
"isGeneratorProvided": null,
"fileSets": null,
"sources": [
{
"path": "^empty\\.c$",
"isGenerated": null,
"fileSetName": null,
"sourceGroupName": "Source Files",
"compileGroupLanguage": "C",
"backtrace": [
{
"file": "^direct/CMakeLists\\.txt$",
"line": 3,
"command": "add_executable",
"hasParent": true
},
{
"file": "^direct/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
]
},
{
"path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/(direct|build/inject_direct_lib_impl\\.build)/.*/other(\\.c)?\\.o(bj)?$",
"isGenerated": true,
"fileSetName": null,
"sourceGroupName": "Object Libraries",
"compileGroupLanguage": null,
"backtrace": [
{
"file": "^direct/CMakeLists\\.txt$",
"line": 13,
"command": "set_property",
"hasParent": true
},
{
"file": "^direct/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
]
}
],
"sourceGroups": [
{
"name": "Source Files",
"sourcePaths": [
"^empty\\.c$"
]
},
{
"name": "Object Libraries",
"sourcePaths": [
"^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/(direct|build/inject_direct_lib_impl\\.build)/.*/other(\\.c)?\\.o(bj)?$"
]
}
],
"compileGroups": [
{
"language": "C",
"sourcePaths": [
"^empty\\.c$"
],
"includes": null,
"frameworks": null,
"defines": [
{
"define": "_MBCS",
"backtrace": null
}
],
"compileCommandFragments": null
}
],
"backtrace": [
{
"file": "^direct/CMakeLists\\.txt$",
"line": 3,
"command": "add_executable",
"hasParent": true
},
{
"file": "^direct/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
],
"folder": null,
"nameOnDisk": "^link_transitive_direct_exe(\\.exe)?$",
"artifacts": [
{
"path": "^direct/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?link_transitive_direct_exe(\\.exe)?$",
"_dllExtra": false
},
{
"path": "^direct/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?link_transitive_direct_exe\\.pdb$",
"_dllExtra": true
}
],
"build": "^direct$",
"source": "^direct$",
"install": null,
"link": {
"language": "C",
"lto": null,
"commandFragments": null
},
"archive": null,
"dependencies": [
{
"id": "^transitive_direct_lib::@79b6367c9e05c77f6a80$",
"backtrace": [
{
"file": "^direct/CMakeLists\\.txt$",
"line": 18,
"command": "target_link_libraries",
"hasParent": true
},
{
"file": "^direct/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
]
},
{
"id": "^inject_direct_lib_impl::@79b6367c9e05c77f6a80$",
"backtrace": [
{
"file": "^direct/CMakeLists\\.txt$",
"line": 13,
"command": "set_property",
"hasParent": true
},
{
"file": "^direct/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
]
},
{
"id": "^ZERO_CHECK::@79b6367c9e05c77f6a80$",
"backtrace": null
}
]
}

View File

@@ -0,0 +1,119 @@
{
"name": "link_usage_exe",
"id": "^link_usage_exe::@79b6367c9e05c77f6a80$",
"directorySource": "^direct$",
"projectName": "Direct",
"type": "EXECUTABLE",
"imported": null,
"local": null,
"abstract": null,
"symbolic": null,
"isGeneratorProvided": null,
"fileSets": null,
"sources": [
{
"path": "^empty\\.c$",
"isGenerated": null,
"fileSetName": null,
"sourceGroupName": "Source Files",
"compileGroupLanguage": "C",
"backtrace": [
{
"file": "^direct/CMakeLists\\.txt$",
"line": 37,
"command": "add_executable",
"hasParent": true
},
{
"file": "^direct/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
]
}
],
"sourceGroups": [
{
"name": "Source Files",
"sourcePaths": [
"^empty\\.c$"
]
}
],
"compileGroups": [
{
"language": "C",
"sourcePaths": [
"^empty\\.c$"
],
"includes": null,
"frameworks": null,
"defines": [
{
"define": "_MBCS",
"backtrace": null
}
],
"compileCommandFragments": null
}
],
"backtrace": [
{
"file": "^direct/CMakeLists\\.txt$",
"line": 37,
"command": "add_executable",
"hasParent": true
},
{
"file": "^direct/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
],
"folder": null,
"nameOnDisk": "^link_usage_exe(\\.exe)?$",
"artifacts": [
{
"path": "^direct/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?link_usage_exe(\\.exe)?$",
"_dllExtra": false
},
{
"path": "^direct/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?link_usage_exe\\.pdb$",
"_dllExtra": true
}
],
"build": "^direct$",
"source": "^direct$",
"install": null,
"link": {
"language": "C",
"lto": null,
"commandFragments": null
},
"archive": null,
"dependencies": [
{
"id": "^usage_lib::@79b6367c9e05c77f6a80$",
"backtrace": [
{
"file": "^direct/CMakeLists\\.txt$",
"line": 39,
"command": "target_link_libraries",
"hasParent": true
},
{
"file": "^direct/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
]
},
{
"id": "^ZERO_CHECK::@79b6367c9e05c77f6a80$",
"backtrace": null
}
]
}

View File

@@ -0,0 +1,96 @@
{
"name": "transitive_direct_lib",
"id": "^transitive_direct_lib::@79b6367c9e05c77f6a80$",
"directorySource": "^direct$",
"projectName": "Direct",
"type": "STATIC_LIBRARY",
"imported": null,
"local": null,
"abstract": null,
"symbolic": null,
"isGeneratorProvided": null,
"fileSets": null,
"sources": [
{
"path": "^empty\\.c$",
"isGenerated": null,
"fileSetName": null,
"sourceGroupName": "Source Files",
"compileGroupLanguage": "C",
"backtrace": [
{
"file": "^direct/CMakeLists\\.txt$",
"line": 4,
"command": "add_library",
"hasParent": true
},
{
"file": "^direct/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
]
}
],
"sourceGroups": [
{
"name": "Source Files",
"sourcePaths": [
"^empty\\.c$"
]
}
],
"compileGroups": [
{
"language": "C",
"sourcePaths": [
"^empty\\.c$"
],
"includes": null,
"frameworks": null,
"defines": [
{
"define": "_MBCS",
"backtrace": null
}
],
"compileCommandFragments": null
}
],
"backtrace": [
{
"file": "^direct/CMakeLists\\.txt$",
"line": 4,
"command": "add_library",
"hasParent": true
},
{
"file": "^direct/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
],
"folder": null,
"nameOnDisk": "^(lib)?transitive_direct_lib\\.(a|lib|l)$",
"artifacts": [
{
"path": "^direct/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?transitive_direct_lib\\.(a|lib|l)$",
"_dllExtra": false
}
],
"build": "^direct$",
"source": "^direct$",
"install": null,
"link": null,
"archive": {
"lto": null
},
"dependencies": [
{
"id": "^ZERO_CHECK::@79b6367c9e05c77f6a80$",
"backtrace": null
}
]
}

View File

@@ -0,0 +1,96 @@
{
"name": "usage_lib",
"id": "^usage_lib::@79b6367c9e05c77f6a80$",
"directorySource": "^direct$",
"projectName": "Direct",
"type": "STATIC_LIBRARY",
"imported": null,
"local": null,
"abstract": null,
"symbolic": null,
"isGeneratorProvided": null,
"fileSets": null,
"sources": [
{
"path": "^empty\\.c$",
"isGenerated": null,
"fileSetName": null,
"sourceGroupName": "Source Files",
"compileGroupLanguage": "C",
"backtrace": [
{
"file": "^direct/CMakeLists\\.txt$",
"line": 36,
"command": "add_library",
"hasParent": true
},
{
"file": "^direct/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
]
}
],
"sourceGroups": [
{
"name": "Source Files",
"sourcePaths": [
"^empty\\.c$"
]
}
],
"compileGroups": [
{
"language": "C",
"sourcePaths": [
"^empty\\.c$"
],
"includes": null,
"frameworks": null,
"defines": [
{
"define": "_MBCS",
"backtrace": null
}
],
"compileCommandFragments": null
}
],
"backtrace": [
{
"file": "^direct/CMakeLists\\.txt$",
"line": 36,
"command": "add_library",
"hasParent": true
},
{
"file": "^direct/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
],
"folder": null,
"nameOnDisk": "^(lib)?usage_lib\\.(a|lib|l)$",
"artifacts": [
{
"path": "^direct/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?usage_lib\\.(a|lib|l)$",
"_dllExtra": false
}
],
"build": "^direct$",
"source": "^direct$",
"install": null,
"link": null,
"archive": {
"lto": null
},
"dependencies": [
{
"id": "^ZERO_CHECK::@79b6367c9e05c77f6a80$",
"backtrace": null
}
]
}

View File

@@ -0,0 +1,77 @@
{
"name": "ZERO_CHECK",
"id": "^ZERO_CHECK::@79b6367c9e05c77f6a80$",
"directorySource": "^direct$",
"projectName": "Direct",
"type": "UTILITY",
"imported": null,
"local": null,
"abstract": null,
"symbolic": null,
"isGeneratorProvided": true,
"fileSets": null,
"sources": [
{
"path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/direct/CMakeFiles/ZERO_CHECK$",
"isGenerated": true,
"fileSetName": null,
"sourceGroupName": "",
"compileGroupLanguage": null,
"backtrace": [
{
"file": "^direct/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
]
},
{
"path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/direct/CMakeFiles/ZERO_CHECK\\.rule$",
"isGenerated": true,
"fileSetName": null,
"sourceGroupName": "CMake Rules",
"compileGroupLanguage": null,
"backtrace": [
{
"file": "^direct/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
]
}
],
"sourceGroups": [
{
"name": "",
"sourcePaths": [
"^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/direct/CMakeFiles/ZERO_CHECK$"
]
},
{
"name": "CMake Rules",
"sourcePaths": [
"^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/direct/CMakeFiles/ZERO_CHECK\\.rule$"
]
}
],
"compileGroups": null,
"backtrace": [
{
"file": "^direct/CMakeLists\\.txt$",
"line": null,
"command": null,
"hasParent": false
}
],
"folder": null,
"nameOnDisk": null,
"artifacts": null,
"build": "^direct$",
"source": "^direct$",
"install": null,
"link": null,
"archive": null,
"dependencies": null
}

View File

@@ -35,6 +35,7 @@ add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../FileAPIExternalSource" "${CMAKE
add_subdirectory(dir)
add_subdirectory(fileset)
add_subdirectory(framework)
add_subdirectory(direct)
set_property(TARGET c_shared_lib PROPERTY LIBRARY_OUTPUT_DIRECTORY lib)
set_property(TARGET c_shared_lib PROPERTY RUNTIME_OUTPUT_DIRECTORY lib)

View File

@@ -0,0 +1,40 @@
project(Direct)
add_executable(link_transitive_direct_exe ../empty.c)
add_library(transitive_direct_lib STATIC ../empty.c)
add_library(inject_direct_lib INTERFACE)
add_library(inject_direct_lib_impl OBJECT other.c)
set(head_targets
EXECUTABLE
SHARED_LIBRARY
MODULE_LIBRARY
)
set_property(TARGET inject_direct_lib PROPERTY INTERFACE_LINK_LIBRARIES_DIRECT
# Skip intermediate targets, only apply to the head target
"$<$<IN_LIST:$<TARGET_PROPERTY:TYPE>,${head_targets}>:inject_direct_lib_impl>"
)
target_link_libraries(link_transitive_direct_exe
# Link interfaces are not supported for executables that do not export
# symbols, so even though this specifies PUBLIC here, the direct dependencies
# should show up as private.
PUBLIC
transitive_direct_lib
)
# This is not an executable, so the direct dependency types should follow the
# keywords specified here.
target_link_libraries(transitive_direct_lib
PUBLIC
inject_direct_lib
INTERFACE
-lm # Doesn't need to exist, just verifying fragments in directDependencies
)
cmake_policy(SET CMP0131 NEW)
add_library(usage_lib STATIC ../empty.c)
add_executable(link_usage_exe ../empty.c)
add_executable(compile_usage_exe ../empty.c)
target_link_libraries(link_usage_exe PRIVATE $<LINK_ONLY:usage_lib>)
target_link_libraries(compile_usage_exe PRIVATE $<COMPILE_ONLY:usage_lib>)

View File