Skip to content
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

Ninja prefers Clang over MSVC #280

Open
FeignClaims opened this issue Sep 13, 2024 · 2 comments
Open

Ninja prefers Clang over MSVC #280

FeignClaims opened this issue Sep 13, 2024 · 2 comments

Comments

@FeignClaims
Copy link
Contributor

FeignClaims commented Sep 13, 2024

log of Test(windows-2022, msvc, _, _):

-- The CXX compiler identification is Clang 17.0.6 with GNU-like command-line
-- The C compiler identification is Clang 17.0.6 with GNU-like command-line

I couldn't track down which commit introduced this issue because the logs have been outdated.

Upvote & Fund

@aminya is using Polar.sh so you can upvote and help fund this issue. The funding is received once the issue is completed & confirmed by you.

Thank you in advance for helping prioritize & fund our backlog!


Fund with Polar
@ClausKlein
Copy link
Contributor

@aminya I have just tested the current main with the example cpp_vcpkg_project project on windows 10 with

MSBuild-Version 17.11.2+c078802d4 für .NET Framework
Microsoft Visual Studio Professional 2022 (64-bit) - Current Version 17.11.2

It have tested the Workflow presets:

  • "windows-msvc-debug"
  • "windows-msvc-release"

I dit not generate a VS solution with cmake, I just opended the project directory from VS2022!

But I had to change some values, first, than in works for me:

MINGW64 ~/Workspace/cmake/project_options/examples/cpp_vcpkg_project (main)
$ git diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 93f08e6..02adf7f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.21...3.28)
+cmake_minimum_required(VERSION 3.25...3.30)

 # set a default CXX standard for the tools and targets that do not specify them.
 # If commented, the latest supported standard for your compiler is automatically set.
@@ -14,13 +14,14 @@ endif()

 # Add project_options from https://github.com/aminya/project_options
 # Change the version in the following URL to update the package (watch the releases of the repository for future updates)
-set(PROJECT_OPTIONS_VERSION "v0.36.4")
-FetchContent_Declare(
-  _project_options
-  URL https://github.com/aminya/project_options/archive/refs/tags/${PROJECT_OPTIONS_VERSION}.zip)
-
-FetchContent_MakeAvailable(_project_options)
-include(${_project_options_SOURCE_DIR}/Index.cmake)
+## set(PROJECT_OPTIONS_VERSION "v0.36.4")
+## FetchContent_Declare(
+##   _project_options
+##   URL https://github.com/aminya/project_options/archive/refs/tags/${PROJECT_OPTIONS_VERSION}.zip)
+##
+## FetchContent_MakeAvailable(_project_options)
+## include(${_project_options_SOURCE_DIR}/Index.cmake)
+include(../../Index.cmake)

 # Define the features of the project
 include("./Features.cmake")
@@ -84,8 +85,8 @@ project_options(
   PREFIX
   "my"
   ENABLE_CACHE
-  ${ENABLE_CPPCHECK}
-  ${ENABLE_CLANG_TIDY}
+  # ${ENABLE_CPPCHECK}
+  # ${ENABLE_CLANG_TIDY}
   ${ENABLE_VS_ANALYSIS}
   # ENABLE_CONAN
   # ENABLE_INTERPROCEDURAL_OPTIMIZATION
diff --git a/cmake/presets/CMakeUnixPresets.json b/cmake/presets/CMakeUnixPresets.json
index 25551d0..dd57396 100644
--- a/cmake/presets/CMakeUnixPresets.json
+++ b/cmake/presets/CMakeUnixPresets.json
@@ -2,7 +2,7 @@
   "version": 6,
   "cmakeMinimumRequired": {
     "major": 3,
-    "minor": 27,
+    "minor": 25,
     "patch": 0
   },
   "include": [
diff --git a/cmake/presets/CMakeWindowsPresets.json b/cmake/presets/CMakeWindowsPresets.json
index 3e63a17..f40eebf 100644
--- a/cmake/presets/CMakeWindowsPresets.json
+++ b/cmake/presets/CMakeWindowsPresets.json
@@ -27,10 +27,12 @@
         "value": "host=x64",
         "strategy": "external"
       },
-      "cacheVariables": {
-        "ENABLE_CPPCHECK_DEFAULT": false,
-        "ENABLE_CLANG_TIDY_DEFAULT": false
-      }
+        "cacheVariables": {
+            "CMAKE_VS_VERSION_RANGE": "[17.0,)",
+            "CMAKE_HOST_SYSTEM_PROCESSOR": "AMD64",
+            "ENABLE_CPPCHECK_DEFAULT": false,
+            "ENABLE_CLANG_TIDY_DEFAULT": false
+        }
     },
     {
       "name": "windows-msvc-debug",

MINGW64 ~/Workspace/cmake/project_options/examples/cpp_vcpkg_project (main)
$

@aminya aminya changed the title Test(windows-2022, msvc, _, _) of ci.yml didn't successfully use msvc as the compiler Ninja prefers Clang over MSVC Sep 17, 2024
@aminya
Copy link
Owner

aminya commented Sep 17, 2024

It seems that Ninja prefers Clang over MSVC. This can be fixed in setup-cpp by setting CXX/CC to cl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants