Setting default compiler in CMake

后端 未结 3 1953
深忆病人
深忆病人 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:50

    You only have to set the toolchain/output format once, typically you'd do this upon running cmake for the first time:

    cmake -G "MinGW Makefiles" .
    

    Instead of the dot you can use your own parameters (if any) and/or the path to the source.

    As an alternative, especially when you're new to CMake, use the GUI version under windows (run cmake-gui without parameters instead of cmake).

    Once opened, set your paths and click on "Configure". If there's no compiler set, it will ask you to pick one (otherwise you have to clear the cache to make it reappear).

    Updated configuration values will appear in red and it will also allow you to select files and paths using the common Windows dialog boxes.

    Once configuration is complete and without errors you can hit "generate" to create your makefiles or project files. To update these later on, you can use cmake-gui again or just use the usual command line version cmake.

提交回复
热议问题