diff options
author | Brad King <brad.king@kitware.com> | 2021-06-14 20:14:35 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-06-15 13:09:28 (GMT) |
commit | 10b2e5346984d95c15d0cc38ddf5c5fad11a6a65 (patch) | |
tree | bdb2a289e10a45a4fa394b6c222a2ede2572584e /Source/cmGlobalNinjaGenerator.cxx | |
parent | 2b9890e9b940db59b4d1633fa5b8067f615ed0f4 (diff) | |
download | CMake-10b2e5346984d95c15d0cc38ddf5c5fad11a6a65.zip CMake-10b2e5346984d95c15d0cc38ddf5c5fad11a6a65.tar.gz CMake-10b2e5346984d95c15d0cc38ddf5c5fad11a6a65.tar.bz2 |
cmScanDepFormat: Remove Fortran-specific compiled-module-path logic
Read and write the `compiled-module-path` field only when explicitly
known. Move the assumption that the `compiled-module-path` can be
derived from the logical module name from the scandep parser to the
`cmake_ninja_dyndep` helper.
Diffstat (limited to 'Source/cmGlobalNinjaGenerator.cxx')
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index cbe1bc8..5108a6f 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -2448,7 +2448,6 @@ cm::optional<cmSourceInfo> cmcmd_cmake_ninja_depends_fortran( for (std::string const& provide : finfo.Provides) { cmSourceReqInfo src_info; src_info.LogicalName = provide; - src_info.CompiledModulePath = provide; info->ScanDep.Provides.emplace_back(src_info); } for (std::string const& require : finfo.Requires) { @@ -2458,7 +2457,6 @@ cm::optional<cmSourceInfo> cmcmd_cmake_ninja_depends_fortran( } cmSourceReqInfo src_info; src_info.LogicalName = require; - src_info.CompiledModulePath = require; info->ScanDep.Requires.emplace_back(src_info); } for (std::string const& include : finfo.Includes) { @@ -2529,8 +2527,18 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile( Json::Value tm = Json::objectValue; for (cmScanDepInfo const& object : objects) { for (auto const& p : object.Provides) { - std::string const mod = cmStrCat( - module_dir, cmSystemTools::GetFilenameName(p.CompiledModulePath)); + std::string mod; + if (!p.CompiledModulePath.empty()) { + // The scanner provided the path to the module file. + mod = p.CompiledModulePath; + if (!cmSystemTools::FileIsFullPath(mod)) { + // Treat relative to work directory (top of build tree). + mod = cmSystemTools::CollapseFullPath(mod, dir_top_bld); + } + } else { + // Assume the module file path matches the logical module name. + mod = cmStrCat(module_dir, p.LogicalName); + } mod_files[p.LogicalName] = mod; tm[p.LogicalName] = mod; } |