-
-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support import std
for CMake
#126
Conversation
Thanks for looking into this!
Hmm, I'm trying to see if I understand this correctly... So this looks for the path And in the case of (I was thrown off for a bit with using
Hmm, how would this setup work? If this is evaluated with So I don't quite see how this approach would work?
This looks like a quite reasonable approach - hopefully they will accept this addition. (It might be good to have comments in the cmake file explaining which file layouts these expect to operate on.)
Thanks for looking into it! |
Yes, cmake paths are purely syntactic and do not access underlying filesystem, cmake has their own logic to do path simplification. That does not work in general (
The key is that cmake |
2f606ab
to
f121566
Compare
Oh, I see - that explains it! That was a bit non-obvious. |
f121566
to
2038295
Compare
https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9442 provided a detection variable for |
Created https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9450 to support proposed installation layout. |
The MR has been accepted by CMake. Using latest nightly build cmake binary from https://cmake.org/files/dev/cmake-3.29.20240423-g5ccb695-linux-x86_64.tar.gz, the -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 to |
Thanks! This looks good to me, so let's merge it. |
https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9337
The coming cmake 3.30 supports
import std
for clang and MSVC.For MSVC, it need to locate
modules.json
which is in${VCToolsInstallDir}/modules
(VCToolsInstallDir = VC/Tools/MSVC/$VER
). https://gitlab.kitware.com/cmake/cmake/-/blob/ca449572ef8b1c6066e88879795900aea9727834/Modules/Compiler/MSVC-CXX-CXXImportStd.cmake#L2-11To support
import std
without those environment variables presets, the specific directory layout is required. There are two ways going on:${VCToolsInstallDir}/modules/*
to installation root. There are only 3 files in themodules
folder:modules.json
,std.ixx
andstd.compat.ixx
. So I think it is acceptable.modules
under installation root to${VCToolsInstallDir}/modules
. This results in a different layout compared to the original MSVC tools layout.VCToolsInstallDir layout:
Proposed msvc-wine installation layout:
This requires to add
"${CMAKE_CXX_COMPILER}/../.."
to above cmake code block. I prefer this way. If we agree, I am going to send a MR to CMake. But if they reject, we have to go with 1.The test is not enabled currently since the new feature is experimental and is gated by
CMAKE_EXPERIMENTAL_CXX_IMPORT_STD
which is a UUID string and may be updated time to time, the value is documented at https://gitlab.kitware.com/cmake/cmake/-/blob/ca449572ef8b1c6066e88879795900aea9727834/Help/dev/experimental.rst.