[libcxx-commits] [libcxx] Rework Modules CMake to be (more) idiomatic. (PR #84936)
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Mar 13 11:53:54 PDT 2024
================
@@ -178,34 +178,13 @@ This is a small sample program that uses the module ``std``. It consists of a
)
FetchContent_MakeAvailable(std)
- #
- # Adjust project compiler flags
- #
-
- add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fprebuilt-module-path=${std_BINARY_DIR}/CMakeFiles/std.dir/>)
- add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fprebuilt-module-path=${std_BINARY_DIR}/CMakeFiles/std.compat.dir/>)
- add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-nostdinc++>)
- # The include path needs to be set to be able to use macros from headers.
- # For example from, the headers <cassert> and <version>.
- add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-isystem>)
- add_compile_options($<$<COMPILE_LANGUAGE:CXX>:${LIBCXX_BUILD}/include/c++/v1>)
----------------
EricWF wrote:
The module cache path bits aren't needed because CMake adds `-fmodule-file=std=<path-to-build>.pcm`, so that's magically handled behind the scenes.
The remainder aren't needed because when you link to a target, the flags of that target are added to your flag set.
This added those flags globally to every target, but the cmake way to do this is via the PUBLIC compile/link options.
https://github.com/llvm/llvm-project/pull/84936
More information about the libcxx-commits
mailing list