Build with CLion using VC6 or Win32
This guide configures CLion for the vc6 and win32 CMake presets. Shared presets, options, targets, output paths, and
installation steps are documented in the Building with CMake guide.
Requirements
Section titled “Requirements”- Windows
- CLion
- Git
- One or both supported Visual C++ toolchains:
- Visual C++ 6 for
vc6 - Visual Studio Build Tools for C++ with the
required components for
win32
- Visual C++ 6 for
CLion’s bundled CMake can be used. The Win32 toolchain can also use the bundled Ninja.
Configure the toolchains
Section titled “Configure the toolchains”Open File > Settings > Build, Execution, Deployment > Toolchains.
Visual C++ 6
Section titled “Visual C++ 6”-
Add a System toolchain and name it exactly
Visual Studio 6. -
Add this environment file:
C:\Program Files (x86)\Microsoft Visual Studio\VC98\Bin\VCVARS32.batWarning: In CLion, ensure the environment file extension is lowercase
.bat, not.BAT. The uppercase extension can prevent CLion from detecting the environment. -
Set Build Tool to VC6’s
NMAKE.EXE:C:\Program Files (x86)\Microsoft Visual Studio\VC98\Bin\NMAKE.EXE -
CLion should detect
cl.exefor both compilers; if it does not, selectVC98\Bin\cl.exemanually.
Add a Visual Studio toolchain, select the Visual Studio Build Tools installation, and name it exactly
Visual Studio. Keep the bundled Ninja build tool.
The exact names matter because CMakePresets.json uses them to select the correct toolchain automatically.
Clone and open the source
Section titled “Clone and open the source”Clone the repository:
git clone https://github.com/TheSuperHackers/GeneralsGameCode.gitOpen the cloned GeneralsGameCode directory in CLion.
Configure the CMake profiles
Section titled “Configure the CMake profiles”After opening the project, CLion imports the profiles from CMakePresets.json:
-
Open File > Settings > Build, Execution, Deployment > CMake.
-
Disable the default
Debugprofile. -
Enable the profiles for either toolchain or both:
Build Visual C++ 6 Win32 Release vc6win32Debug vc6-debugwin32-debugProfile vc6-profilewin32-profile -
Wait for CMake to finish loading the selected profiles.
Retail compatibility: Only VC6 Release builds are compatible with retail multiplayer and replays.
Configure running
Section titled “Configure running”Configure both g_generals and z_generals separately:
-
Select the game target from the Run/Debug Configurations dropdown, open the dropdown again, and choose Edit Configurations.
-
Set optional Program arguments, such as
-winor-quickstart. -
Set Executable to the installed game executable:
C:\Path\To\Generals\generalsv.exeC:\Path\To\Zero Hour\generalszh.exe -
Set Working directory to the corresponding game directory.
-
Under Before launch, remove the Build step and add the top-level
installtarget instead. -
Enable Run as administrator if the install target is in a protected directory such as
Program Files.
Build and run
Section titled “Build and run”Select a CMake profile and the g_generals or z_generals configuration, then click Run. The install step copies
the built executable into the game directory before CLion launches it.
See Install to set the game directories manually.
Troubleshooting
Section titled “Troubleshooting”A preset is missing
Section titled “A preset is missing”Confirm that CLion opened the repository root containing CMakePresets.json. Use Help > Find Action > Load CMake
Presets, or reset the CMake cache and reload the project.
A toolchain is not selected
Section titled “A toolchain is not selected”Confirm that the toolchains are named exactly Visual Studio 6 and Visual Studio, then reload the CMake project.
The VC6 compiler is not found
Section titled “The VC6 compiler is not found”Confirm that the VC6 toolchain uses VCVARS32.bat as its environment file. If necessary, select VC98\Bin\cl.exe as
both compilers and reset the affected CMake profile.