friendlyanon / cmake-init

The missing CMake project initializer
GNU General Public License v3.0
1.98k stars 75 forks source link

It seems that my previous installation of Visual Studio 2022 edited my configurations #91

Closed TheMystery28 closed 1 year ago

TheMystery28 commented 1 year ago

Hello and thank you for your time. I've been searching and trying several things for hours, even defining "CMAKE_GENERATOR" with the name of the generator I want ("MinGW Makefiles") in the variables, I've also checked with "cmake --help" and it is indeed MinGw the default generator

However, every time I try the "cmake --preset=dev" command for a project I'm creating with cmake-init, I get the following message

cmake --preset=dev
Preset CMake variables:

  BUILD_MCSS_DOCS="ON"
  CMAKE_CXX_CPPCHECK="cppcheck;--inline-suppr"
  CMAKE_CXX_EXTENSIONS="OFF"
  CMAKE_CXX_FLAGS="/sdl /analyze /analyze:external- /guard:cf /utf-8 /diagnostic
s:caret /w14165 /w44242 /w44254 /w44263 /w34265 /w34287 /w44296 /w44365 /w44388
/w44464 /w14545 /w14546 /w14547 /w14549 /w14555 /w34619 /w34640 /w24826 /w14905
/w14906 /w14928 /w45038 /W4 /permissive- /volatile:iso /Zc:inline /Zc:preprocess
or /Zc:enumTypes /Zc:lambda /Zc:__cplusplus /Zc:externConstexpr /Zc:throwingNew
/EHsc"
  CMAKE_CXX_STANDARD="20"
  CMAKE_CXX_STANDARD_REQUIRED="ON"
  CMAKE_EXE_LINKER_FLAGS="/machine:x64 /guard:cf"
  greatness_DEVELOPER_MODE="ON"

Preset environment variables:

  EnforceProcessCountAcrossBuilds="true"
  UseMultiToolTask="true"

CMake Error at CMakeLists.txt:5 (project):
  Generator

    Visual Studio 17 2022

  could not find any instance of Visual Studio.

-- Configuring incomplete, errors occurred!

Then I tried to specify my generator with -g but it didn't work

cmake --preset=dev -G "MinGW Makefiles"

Preset CMake variables:

  BUILD_MCSS_DOCS="ON"
  CMAKE_CXX_CPPCHECK="cppcheck;--inline-suppr"
  CMAKE_CXX_EXTENSIONS="OFF"
  CMAKE_CXX_FLAGS="/sdl /analyze /analyze:external- /guard:cf /utf-8 /diagnosti
cs:caret /w14165 /w44242 /w44254 /w44263 /w34265 /w34287 /w44296 /w44365 /w4438
8 /w44464 /w14545 /w14546 /w14547 /w14549 /w14555 /w34619 /w34640 /w24826 /w149
05 /w14906 /w14928 /w45038 /W4 /permissive- /volatile:iso /Zc:inline /Zc:prepro
cessor /Zc:enumTypes /Zc:lambda /Zc:__cplusplus /Zc:externConstexpr /Zc:throwin
gNew /EHsc"
  CMAKE_CXX_STANDARD="20"
  CMAKE_CXX_STANDARD_REQUIRED="ON"
  CMAKE_EXE_LINKER_FLAGS="/machine:x64 /guard:cf"
  greatness_DEVELOPER_MODE="ON"

Preset environment variables:

  EnforceProcessCountAcrossBuilds="true"
  UseMultiToolTask="true"

CMake Error at CMakeLists.txt:5 (project):
  Generator

    MinGW Makefiles

  does not support platform specification, but platform

    x64

  was specified.

CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

So I think the problem is that cmake-init take visual studio as a default (even tough it's uninstalled) and that it doesn't have any parameters for the generators, so I'm a bit lost about what to do. I can either reset my PC or learn cmake.

Could you please help me?

TheMystery28 commented 1 year ago

In the end, I didn't solve my problem, but it seems to originate from Cmake. Sorry for the inconvenience.

friendlyanon commented 1 year ago

cmake-init goes with platform defaults, which mingw on Windows is not. The defaults are setup to use VS2022.

If you wish to use mingw, you have to DIY a bit. There's also this https://github.com/friendlyanon/cmake-init/issues/89#issuecomment-1460517691