Setting default compiler in CMake

后端 未结 3 1954
深忆病人
深忆病人 2021-01-31 08:11

I\'m using CMake version 2.8 on WinXP SP3. Whenever i run my CMakeLists script by default CMake use Visual Studio 10 compiler. I\'ve tried to do:

SET( CMAKE_CXX_         


        
3条回答
  •  长发绾君心
    2021-01-31 08:38

    Under Windows CMake uses the newest Visual Studio installation as default generator, unless the generator is explicitly specified upon invoking CMake. This behavior is hard coded and cannot be changed.

    As a work-around you can use a batch wrapper script titled cmake.bat with the following contents:

    @cmake.exe -G "MinGW Makefiles" %*
    

    The script should be placed in a directory on the system PATH and should take precedence over the CMake executable cmake.exe.

    The script invokes cmake.exe with MinGW as a generator and forwards all other parameters to it.

提交回复
热议问题