howto:module_std_gcc15
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
howto:module_std_gcc15 [2025-04-25 13:21] – [CMake] rrichter | howto:module_std_gcc15 [2025-04-27 09:33] (aktuell) – [How to use C++ module std in GNU g++-15] rrichter | ||
---|---|---|---|
Zeile 15: | Zeile 15: | ||
Prerequisites: | Prerequisites: | ||
- | * GCC 15.1 | + | * g++ 15.1 (just released!) or [[https:// |
* CMake 3.31.3 | * CMake 3.31.3 | ||
* Ninja 1.12.1 | * Ninja 1.12.1 | ||
Zeile 22: | Zeile 22: | ||
* CMake supports C++ modules for Ninja generator only | * CMake supports C++ modules for Ninja generator only | ||
- | * CMake tells Ninja nothing about module std. Hack: extra library '' | + | * CMake tells Ninja nothing about module std. (I wasn't able to get[[https:// |
+ | * Some features like '' | ||
==== CMake ==== | ==== CMake ==== | ||
Zeile 34: | Zeile 35: | ||
LANGUAGES CXX) | LANGUAGES CXX) | ||
- | # temporary hack for GCC g++16.0 HEAD https:// | + | # hack #1: temporary hack for GCC g++16.0 HEAD https:// |
# to remove when g++ & CMake know about module std | # to remove when g++ & CMake know about module std | ||
add_library(module_std) | add_library(module_std) | ||
Zeile 41: | Zeile 42: | ||
PUBLIC | PUBLIC | ||
FILE_SET CXX_MODULES FILES | FILE_SET CXX_MODULES FILES | ||
- | gnu/std.cc # modified | + | gnu/std.cc # copied |
) | ) | ||
target_compile_features(module_std PUBLIC cxx_std_26) | target_compile_features(module_std PUBLIC cxx_std_26) | ||
Zeile 47: | Zeile 48: | ||
# target_link_libraries(...XYZ... PRIVATE module_std) | # target_link_libraries(...XYZ... PRIVATE module_std) | ||
- | # another | + | # hack #2: advanced features like std:: |
# target_link_libraries(...XYZ... PRIVATE stdc++exp) | # target_link_libraries(...XYZ... PRIVATE stdc++exp) | ||
Zeile 58: | Zeile 59: | ||
) | ) | ||
target_compile_features(my_module PUBLIC cxx_std_26) | target_compile_features(my_module PUBLIC cxx_std_26) | ||
- | target_link_libraries(my_module PRIVATE module_std) | + | target_link_libraries(my_module PRIVATE module_std) |
add_executable(demo src/ | add_executable(demo src/ | ||
target_compile_features(demo PUBLIC cxx_std_26) | target_compile_features(demo PUBLIC cxx_std_26) | ||
- | target_link_libraries(demo PRIVATE module_std) | ||
target_link_libraries(demo PRIVATE my_module) | target_link_libraries(demo PRIVATE my_module) | ||
- | target_link_libraries(demo PRIVATE stdc++exp) | + | target_link_libraries(demo PRIVATE module_std) # hack #1 |
+ | target_link_libraries(demo PRIVATE stdc++exp) | ||
</ | </ |
howto/module_std_gcc15.1745580067.txt.gz · Zuletzt geändert: 2025-04-25 13:21 von rrichter