Warning using Clang-17
Opened this issue · 1 comments
elykwilliams commented
I'm building on Ubuntu 20.04 with the compiler
Ubuntu clang version 17.0.0 (++20230811073125+8f4dd44097c9-1
exp120230811073223.19)
Target: x86_64-pc-linux-gnu
Thread model: posix
Using build tool Unix Makefiles
GNU Make 4.2.1
Built for x86_64-pc-linux-gnu
With CMake version
cmake version 3.16.3
And I get the following compiler warning
[ 20%] Generating hello.pcm
[ 40%] Generating hello.o
Scanning dependencies of target hello
[ 60%] Linking CXX static library libhello.a
[ 60%] Built target hello
Scanning dependencies of target main
[ 80%] Building CXX object CMakeFiles/main.dir/main.cc.o
warning: the form '-fmodule-file=<BMI-path>' is deprecated for standard C++ named modules;consider to use '-fmodule-file=<module-name>=<BMI-path>' instead [-Weager-load-cxx-named-modules]
A simple fix to get rid of the compiler warning was to use the following in modules.cmake::167 - 171
get_filename_component(pcm_name ${src} NAME_WE)
set(pcm ${pcm_name}.pcm)
# Propagate -fmodule-file=*.pcm to targets that link with this library.
target_compile_options(
${name} INTERFACE -fmodule-file=${pcm_name}=${CMAKE_CURRENT_BINARY_DIR}/${pcm})
I'm still quite new to modules so I don't know how correct this actually is.
vitaut commented
Could you submit a PR?