# I'm struggling to understand how to run cmake on windows to clone a project that uses SDL2

**URL:** <https://discourse.cmake.org/t/im-struggling-to-understand-how-to-run-cmake-on-windows-to-clone-a-project-that-uses-sdl2/5355>\
**Category:** Usage\
**Created:** [April 2, 2022, 7:36am UTC](https://discourse.cmake.org/t/im-struggling-to-understand-how-to-run-cmake-on-windows-to-clone-a-project-that-uses-sdl2/5355 "2022-04-02T07:36:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RoadHog](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/r/a5b964/32.png) [@RoadHog](https://discourse.cmake.org/u/RoadHog)\
**Post date:** [April 2, 2022, 7:36am UTC](https://discourse.cmake.org/t/im-struggling-to-understand-how-to-run-cmake-on-windows-to-clone-a-project-that-uses-sdl2/5355/1 "2022-04-02T07:36:51Z")

</div>

This is my first time using cmake, I cloned a project form github on my linux Virtual boxes, and ran the appropriate commands and it worked wonderfully.

Problem is, when I try to use Visual studio on windows, everything goes south.

I first clone the repo:

## [https://github.com/JacobEckroth/BetterChess.git:](https://github.com/JacobEckroth/BetterChess.git:)

and then mkdir a build folder, cd into it and input cmake .  
I get this error:

name@DESKTOP-G8CSCPT MINGW64 ~/source/repos/BetterChess/build (main)  
$ cmake ..  
– Building for: Visual Studio 17 2022  
– Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042.  
– The C compiler identification is MSVC 19.31.31104.0  
– The CXX compiler identification is MSVC 19.31.31104.0  
– Detecting C compiler ABI info  
– Detecting C compiler ABI info - done  
– Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe - skipped  
– Detecting C compile features  
– Detecting C compile features - done  
– Detecting CXX compiler ABI info  
– Detecting CXX compiler ABI info - done  
– Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe - skipped  
– Detecting CXX compile features  
– Detecting CXX compile features - done  
CMake Error at C:/Users/name/cmake-3.23.0-windows-x86\_64/cmake-3.23.0-windows-x86\_64/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:230 (message):  
Could NOT find SDL2 (missing: SDL2\_LIBRARY SDL2\_INCLUDE\_DIR)  
Call Stack (most recent call first):  
C:/Users/name/cmake-3.23.0-windows-x86\_64/cmake-3.23.0-windows-x86\_64/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:594 (\_FPHSA\_FAILURE\_MESSAGE)  
cmake/FindSDL2.cmake:313 (FIND\_PACKAGE\_HANDLE\_STANDARD\_ARGS)  
CMakeLists.txt:4 (find\_package)

– Configuring incomplete, errors occurred!  
See also “C:/Users/name/source/repos/BetterChess/build/CMakeFiles/CMakeOutput.log”.  
See also “C:/Users/name/source/repos/BetterChess/build/CMakeFiles/CMakeError.log”.

How do I fix this?, I have SDL2 in my machine, and able to use it vs and make projects with it, but when cloning repos, It doesn’t work.

---

<div class="post-metadata">

**Author:** ![RoadHog](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/r/a5b964/32.png) [@RoadHog](https://discourse.cmake.org/u/RoadHog)\
**Post date:** [April 2, 2022, 8:16am UTC](https://discourse.cmake.org/t/im-struggling-to-understand-how-to-run-cmake-on-windows-to-clone-a-project-that-uses-sdl2/5355/2 "2022-04-02T08:16:03Z")

</div>

![image](https://discourse.cmake.org/uploads/default/original/2X/f/f7c3237f7b6b5bd7acb68b956f14be8996557f93.png)

Here is an image of the gui version of the errror.

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [April 2, 2022, 12:08pm UTC](https://discourse.cmake.org/t/im-struggling-to-understand-how-to-run-cmake-on-windows-to-clone-a-project-that-uses-sdl2/5355/3 "2022-04-02T12:08:10Z")

</div>

You probably have to help CMake find SDL2 if it isn’t in a “typical” location. `SDL2_PATH` looks promising; can you try setting it to the SDL2 installation prefix? If that doesn’t work, making a new `SDL2_ROOT` variable with that value may work better.
