include-what-you-use is included but is not presented as a CMake option

Đang mở Phù hợp với người mới
#161 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
82/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cmake
Lĩnh vực
build-system

Hướng nghiên cứu

Bắt đầu trong cmake/StaticAnalyzers.cmake và phần cuối của ProjectOptions.cmake, so sánh đường dẫn include-what-you-use với myproject_enable_clang_tidy và với phần triển khai trước đó được liên kết trong issue. Cấu hình dự án hoặc mở cmake-gui để xác minh rằng tùy chọn include-what-you-use được hiển thị và việc bật tùy chọn này sẽ đi đến macro hiện có.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

In /cmake/StaticAnalyzers.cmake, the macro myproject_enable_include_what_you_use is declared.

However, myproject_enable_include_what_you_use is never actually set as an option elsewhere. Therefore, it's not possible to set it as an option in places like cmake-gui or based on the configuration.

For instance, myproject_enable_clang_tidy is right above it. I see that at the bottom of ProjectOptions.cmake that macro is called if myproject_ENABLE_CLANG_TIDY is set to true. There is no equivalent for myproject_enable_include_what_you_use.

It appears when iwyu was added, https://github.com/cpp-best-practices/cmake_template/blob/3a8c8f9793fb9805af558bfe097491e9a6efc97c/cmake/StaticAnalyzers.cmake was simpler. It did have option(ENABLE_INCLUDE_WHAT_YOU_USE "Enable static analysis with include-what-you-use" OFF).

StaticAnalyzers.cmake has had some changes, but it appears

macro(myproject_enable_include_what_you_use)
  find_program(INCLUDE_WHAT_YOU_USE include-what-you-use)
  if(INCLUDE_WHAT_YOU_USE)
    set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${INCLUDE_WHAT_YOU_USE})
  else()
    message(WARNING "include-what-you-use requested but executable not found")
  endif()
endmacro()

is orphaned code that doesn't do anything. If I am mistaken hopefully, someone can explain this a little bit better to me. I've had to heavily edit my fork of this template because we can only support CMake 3.12 at this time, due to our usage of MSVS 2017. I'm doing some cleanup and noticed that iwyu is never really used. Looking at the code on the main branch, I don't see it being used so it's not like I unintentionally removed it.

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

Mở trong Codespaces

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

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của cpp-best-practices/cmake_template

Tất cả issue của cpp-best-practices/cmake_template

Issue tương tự

Thêm issue về Build System

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.