By the way, I indicate header files as path. I worked with SDL2 on XCode without problem (easy) Rather then compiler location, I prefer project location. There is also a complete project in my github repository here. sdl2 libraries should download individually. Target is an executable or a library to be built using a CMake script. The CMake tool window opens up automatically in case of a load failure. if (NOT SDL2_IMAGE_INCLUDE_DIR AND SDL2IMAGE_INCLUDE_DIR ) set (SDL2_IMAGE_INCLUDE_DIR $ ) mark_as_advanced (SDL2_IMAGE_LIBRARY SDL2_IMAGE_INCLUDE_DIR ) Click on the left-hand toolbar of the IDE to open the CMake tool window, where you can check the progress and status of project load. This was influenced by the FindSDL.cmake # module, but with modifications to recognize OS X frameworks and # additional Unix paths (FreeBSD, etc). configure -prefix=$SDLDIR used in building SDL. #.rst: # FindSDL2_image # - # Locate SDL2_image library # This module defines: # :: # SDL2_IMAGE_LIBRARIES, the name of the library to link against # SDL2_IMAGE_INCLUDE_DIRS, where to find the headers # SDL2_IMAGE_FOUND, if false, do not try to link against # SDL2_IMAGE_VERSION_STRING - human-readable string containing the # version of SDL2_image # For backward compatibility the following variables are also set: # :: # SDL2IMAGE_LIBRARY (same value as SDL2_IMAGE_LIBRARIES) # SDL2IMAGE_INCLUDE_DIR (same value as SDL2_IMAGE_INCLUDE_DIRS) # SDL2IMAGE_FOUND (same value as SDL2_IMAGE_FOUND) # $SDLDIR is an environment variable that would correspond to the #. With CMake 3.15, it has become possible to use the Clang compiler on Windows with the MinGW-w64/MinGW toolchain. CLion also checks the script loading time and terminates the execution if it takes too long. cmakeminimumrequired (VERSION 3. You will get notifications in case of script loading issues. See accompanying # file Copyright.txt or for details. I am pretty new to Clion Ide and I need help setting up sdl2 to so far I have tried videos on youtube but they have not worked can someone post a detailed guide on setting up Clion and sdl2 on windows, please. I always get the same error: could not find SDL2 (missing: SDL2_LIBRARY)ĭo you have any ideas that could help me solve this problem, it’s frustrating to be not able to use CLion because i prefer it over Visual Studio.# Distributed under the OSI-approved BSD 3-Clause License. I have tried to follow everything i find on google about using SDL2 with CLion but it seems nothing works. My SDL2 folder is in the root of my harddrive c:\SDL2-2.0.3īut i have also tried to have folder in my project named SDL2 and it does not work. Here is a complete CMakeLists.txt file that can compile a simple SDL2 App Most third party libraries that use CMake to build do so in the exact same way. This problem is actually separate from CLion, youll need to install SDL in whatever way is supported by or OS (win32 exe, apt-get, brew, etc). I expect any tutorial on how to build a library using CMake would be appropriate. Simply download, place it in a dedicated folder, and add that folder to the CMAKE_MODULE_PATH. I have downloaded the appropriate files for SDL2 SDL2-devel-2.0.14-VC.zip (Visual C++ 32/64-bit), but am unsure of where to begin with installing it. However a much better way is to use the FindSDL2.cmake module that’s been floating around the internet. Provides a separate development package or SDK, be sure it has beenīeing rather new to CMake (and not knowing how to create a decent FindSDL2.cmake module), I initially solved the problem by referencing the files manually: "SDL2_DIR" to a directory containing one of the above files. You’ll get error messages such as:ĬMake Error at CMakeLists.txt:8 (find_package):īy not providing "FindSDL2.cmake" in CMAKE_MODULE_PATH this project hasĪsked CMake to find a package configuration file provided by "SDL2", butĬould not find a package configuration file provided by "SDL2" with any ofĪdd the installation prefix of "SDL2" to CMAKE_PREFIX_PATH or set ubuntu config -default-user root The following image shows the state of CLion after I switched to root. (images, sounds etc.) /build/modules - Your custom CMake modules. Typical folder structure: /include - your header files. Out of the box, CMake isn’t able to find the SDL2 library. My Windows user is administrator, so I suspect that WSL has insufficient permissions, and I tried to switch the default user of WSL to root. This means that SDL2 + Google Test 1.8.1 can be build using CLion, MinGW & CMake on Windows OS, which was NOT possible before. A basic template for building apps/games using the SDL2 libraries with CMake and MinGW compiler on Windows.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |