-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Error when using installed c++ module with MSVC #4491
Copy link
Copy link
Closed
Description
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:
dist/lib/cmake/fmt/fmt-targets.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"
)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?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels