cmake: Selecting a generator within CMakeLists.txt
cmake
Solution
Here is what worked for me - create a file called PreLoad.cmake in your project dir containing this:
`set (CMAKE_GENERATOR "Unix Makefiles" CACHE INTERNAL "" FORCE)`
Problem
I would like to force CMake to use the "Unix Makefiles" generator from within CMakeLists.txt. This is the command I use now. ``` cmake -G "Unix Makefiles" . ``` I would like it to be this. ``` cmake . ``` When running on windows with VC installed and a custom tool-chain. I would expect to be-able to set the generator in the `CMakeLists.txt` file. Maybe something like this. ``` set(CMAKE_GENERATOR "Unix Makefiles") ```