4
votes

I want to add this library to my project. However, it does not come with pre-compiled files. It asks me to build the library myself with cmake, which I am not familiar with. One of its dependencies is SDL2. So I download the sdl2 development libraries folder. In cmake, I click configure and choose the generator. After a couple of seconds processing, a window pops up showing the error: Error in configuration process project files may be invalid

And this is what the log screen shows:

The C compiler identification is MSVC 18.0.40629.0
The CXX compiler identification is MSVC 18.0.40629.0
Check for working C compiler using: Visual Studio 12 2013
Check for working C compiler using: Visual Studio 12 2013 -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler using: Visual Studio 12 2013
Check for working CXX compiler using: Visual Studio 12 2013 -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/FindPackageHandleStandardArgs.cmake:148 (message): Could NOT find SDL2 (missing: SDL2_INCLUDE_DIR SDL2_LIBRARY)
Call Stack (most recent call first):

C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE) cmake/FindSDL2.cmake:18 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:30 (FIND_PACKAGE)

Configuring incomplete, errors occurred!
See also "E:/game dev/libraries/libSDL2pp-master/build/CMakeFiles/CMakeOutput.log".

Could anyone tell me what to do? I am not sure that I am doing the right thing. Thank you.

1
You need to have SDL2 installed (you did) and you have to tell CMake where to look for it. Just edit the variables mentioned in the output (SDL2_INCLUDE_DIR SDL2_LIBRARY).usr1234567
What do you mean by editting the variables? Can you explain a little more detail?Stoatman
With the CMake-Gui you get a list of variables. Or edit CMakeCache.txt inside your build directory.usr1234567
You may modify the SDL 1.2 modules... stackoverflow.com/questions/23850472/…Polluks

1 Answers

-1
votes

cmake doesn't come with a module for finding sdl2 by default. That's most likely the reason why you provided your own in cmake/FindSDL2.cmake. As you are on windows, it is most likely that you have to set an environment variable to point to the sdl2 installation directory (but this is really something that depends on the FindSDL2.cmake that you use).