Errors when trying to use C++ modules with cmake and GCC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have been working on upgrading the HPX build system to support C++
modules, while trying to experiment with GCC support for C++ modules, I
keep running into this issue of unrecognized command-line options.

`
g++: error: unrecognized command-line option
‘-fdep-file=CMakeFiles/std_module_example.dir/t3.cxx.o.ddi’
g++: error: unrecognized command-line option
‘-fdep-output=CMakeFiles/std_module_example.dir/t3.cxx.o’
g++: error: unrecognized command-line option ‘-fdep-format=trtbd’


The following in the CMakeLists.txt file :

cmake_minimum_required(VERSION 3.23)
project(std_module_example CXX)
set(CMAKE_CXX_COMPILER "/home/hhn/makes/gcc-install/usr/local/bin/g++")

message(STATUS "${CMAKE_CXX_COMPILER}")

set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API
"2182bf5c-ef0d-489a-91da-49dbc3090d2a")

if(WIN32)
include(msvc_modules.cmake)
else()
include(gcc_modules.cmake)
endif()

set(CMAKE_CXX_STANDARD 20)

add_library(std_module_example)
target_link_libraries(std_module_example)

target_sources(std_module_example
PRIVATE
t4.cxx
PUBLIC
FILE_SET cxx_modules TYPE CXX_MODULES FILES
t1.cxx t2.cxx t3.cxx
)

add_executable(main main.cxx)
target_link_libraries(main std_module_example)


`

I have tried this with g++ 11.3, g++ 12.1 installed using ubuntu package
managers,
I have also tried the same using this certain patch
<https://github.com/mathstuf/gcc/tree/p1689r5> as suggested by the user on
an online forum
<https://discourse.cmake.org/t/module-support-for-g-and-clang/7367/2>.
I have also tried the same using the master
<https://github.com/gcc-mirror/gcc> and devel/c++-modules
<https://github.com/gcc-mirror/gcc/tree/devel/c++-modules> branch on gcc
repo.

All of them have given the same errors. Also the devel/c++-modules branch
compiles to g++ version of g++ (GCC) 11.0.0 20210203 (experimental)
[c++-modules revision 20230201-1505], while the master branch has
version g++ (GCC) 13.0.1 20230201 (experimental).





-- 
Hari Hara Naveen




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux