← All tasks
cppfmtlib/fmt #4491Not a task: already works

Error when using installed c++ module with MSVC

envgap__fmtlib__fmt-4491

01 / FAILURE SIGNATURE

As reported upstream

If I try to use this in my project via `import fmt;` and `find_package(fmt CONFIG REQUIRED)` + `target_link_libraries(test-lib PRIVATE fmt::fmt)` I get the following error:
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
20c8fdad0605a1627a3f6d15cad693a3fbe2ecbf
Manifest
CMakeLists.txt
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

fmtlib/fmt #4491 · read the original issue
First of all I am not sure if this is a cmake or fmtlib issue: 
I am using the latest MSVC Version and CMake 4.0.3
I am configured master fmtlib with `-G Ninja -DFMT_MODULE=ON` and installed it to prefix 

If I try to use this in my project via `import fmt;` and `find_package(fmt CONFIG REQUIRED)` + `target_link_libraries(test-lib PRIVATE fmt::fmt)` I get the following error: 
```
[build] [1/7  14% :: 0.405] Scanning F:\git_projects\fmt\build\dist\include\fmt\src\fmt.cc for CXX dependencies
[build] FAILED: CMakeFiles/fmt__fmt@synth_c5f2e4a688d1.dir/4feac3a26265.bmi.ddi 
[build] C:\PROGRA~1\MIB055~1\2022\PROFES~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\cl.exe  -external:IF:\git_projects\fmt\build\dist\include -external:W0 /DWIN32 /D_WINDOWS /EHsc /Ob0 /Od -std:c++20 -MDd -RTC1 -Zi /interface /ifcOutput CMakeFiles\fmt.dir\fmt.ifc /utf-8 /reference fmt=CMakeFiles\fmt.dir\fmt.ifc -ifcOnly -ifcOutput CMakeFiles\fmt__fmt@synth_c5f2e4a688d1.dir\4feac3a26265.bmi F:\git_projects\fmt\build\dist\include\fmt\src\fmt.cc -nologo -TP -showIncludes -scanDependencies CMakeFiles\fmt__fmt@synth_c5f2e4a688d1.dir\4feac3a26265.bmi.ddi -FoCMakeFiles\fmt__fmt@synth_c5f2e4a688d1.dir\4feac3a26265.bmi
[build] c1xx: error C3472: new output file name CMakeFiles\fmt__fmt@synth_c5f2e4a688d1.dir\4feac3a26265.bmi (set on command line) conflicts with previous file name CMakeFiles\fmt.dir\fmt.ifc
```

The problem seems to be the following:
<details><summary>dist/lib/cmake/fmt/fmt-targets.cmake</summary>
<p>

```cmake
set_target_properties(fmt::fmt PROPERTIES
  CXX_MODULE_STD ""
  IMPORTED_CXX_MODULES_COMPILE_FEATURES "cxx_std_20;cxx_std_11"
  IMPORTED_CXX_MODULES_COMPILE_OPTIONS "/interface;/ifcOutput;CMakeFiles\\fmt.dir\\fmt.ifc;\$<\$<AND:\$<COMPILE_LANGUAGE:CXX>,\$<CXX_COMPILER_ID:MSVC>>:/utf-8>"
  IMPORTED_CXX_MODULES_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
  INTERFACE_COMPILE_FEATURES "cxx_std_20;cxx_std_11"
  INTERFACE_COMPILE_OPTIONS "/reference;fmt=CMakeFiles\\fmt.dir\\fmt.ifc;\$<\$<AND:\$<COMPILE_LANGUAGE:CXX>,\$<CXX_COMPILER_ID:MSVC>>:/utf-8>"
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
)
```

</p>
</details> 

If I remove `/interface;/ifcOutput;CMakeFiles\\fmt.dir\\fmt.ifc` and `/reference;fmt=CMakeFiles\\fmt.dir\\fmt.ifc` the project compiles fine. The question is who is adding these options? 
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]