Issues with automatic VS environment setup via vcvarsall.bat
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- cmake
- Lĩnh vực
- build-system, operating-systems
Hướng nghiên cứu
Tìm logic template chạy vcvarsall.bat và chuyển môi trường của nó vào CMake. Tái hiện báo cáo trên Windows với một giá trị môi trường kết thúc bằng dấu gạch chéo ngược, sau đó cấu hình bằng Ninja generator và thử build. Hoàn tất có nghĩa là các giá trị môi trường vẫn nguyên vẹn và build đã được cấu hình có thể tìm thấy trình biên dịch và linker MSVC mà không chạy lại vcvarsall.bat.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I believe there are some issues with the way this template attempts to automatically run vcvarsall.bat when compiling with MSVC on Windows.
First Issue: Trailing slashes in environment variables
The first issue is related to how CMake handles lists. After executing vcvarsall.bat, your cmake script copies the environment to string, makes some replacements, and then copies the environment to the current cmake environment. This works fine until an environment value has a trailing backslash at the end of its value (e.g JAVA_HOME).
When this happens, you end up with a list in CMake that looks something like this:
...;JAVA_HOME=C:\Path\To\Java\;LIB=list__sep__of__sep__lib__sep__paths
Because of the trailing backslash, when cmake iterates through the list, it tries to set the JAVA_HOME environment to C:\Path\To\Java;LIB=list;of;lib;paths. The only way I've found to work around this behavior is to also replace all slashes in the environment output with slash and restore them before setting the environment variable.
Second Issue: The VS Environment is lost after the configure step
Running cmake to configure the project works, since the script sets up the VS environment automatically (assuming you don't lose the LIB environment variable due to the previous issue like I did). The problem is the environment is lost again after the configure step, so trying to build will fail indicating it can't find the necessary compiler/link executable. This occurred while using the Ninja generator. I don't know if this occurs with the MSVC generator.
The only way to fix this is to manually run vcvarsall.bat again before executing the build step. I haven't figured out a way to avoid this problem.
At least that was my experience.
- Ngôn ngữ chính
- CMake
- Star
- 1.8k
- Fork
- 205
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của cpp-best-practices/cmake_template
-
Put back `-Wsign-conversion` for gcc in CompilerWarnings.cmakeCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Enable sanitizers globallyĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
cpp-best-practices/cmake_template#140 · 2 bình luận ·
-
From-scratch clone/build fails on `src/ftxui_sample/CMakeFiles/intro.dir/main.cpp.obj`Có thể đã có người làm @leftibot đã nhận 195 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
cpp-best-practices/cmake_template#139 · 2 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
cpp-best-practices/cmake_template#91 · 2 bình luận ·
Tất cả issue của cpp-best-practices/cmake_template
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
immortalwrt/immortalwrt#2522 ·
-
Font inlining cache is not created or reusedCó thể đã có người làm @nagahara-naoki đã nhận hôm nay. Đang mởarea: @angular/build
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
angular/angular-cli#34719 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
osaurus-ai/osaurus#3422 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
foundation/foundation-emails#2127 ·