In order to use it you have to place it somewhere in your project for instance into a cmake subdirectory. REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR You can use the following code: cmake_minimum_required (VERSION 3.7 ) project (SDL2Test ) find_package (SDL2 REQUIRED ) include_directories ( $ ) include (FindPackageHandleStandardArgs ) FIND_PACKAGE_HANDLE_STANDARD_ARGS (SDL You need to create a CMakeLists.txt file for your project that includes SDL2 In thisīlog post I will describe the necessary steps to use SDL2 with CMake on both Together with CMake to build a cross platform multimedia application.
#SETTING UP CMAKE LINUX CODE#
The CMake Tools extension integrates Visual Studio Code and CMake to make it easy to configure, build, and debug your C++ project.Ģ - you may have a later version, but unless you need a later version, you shouldn’t require it (as that means people won’t be able to build your project without first installing a newer version of CMake, manually).SDL2 is the newest version of the Simple Directmedia Layer API. What does CMake do in Linux?ĬMake is an open-source, cross-platform tool that uses compiler and platform independent configuration files to generate native build tool files specific to your compiler and platform. The source_dir specifies the directory in which the source CMakeLists.
#SETTING UP CMAKE LINUX INSTALL#
You’ll also need to install CMake, a compiler, a debugger, and build tools. Install the CMake Tools extension by searching for ‘CMake tools’ in the Extensions view (Ctrl+Shift+X). Install the C/C++ extension by searching for ‘c++’ in the Extensions view (Ctrl+Shift+X).
#SETTING UP CMAKE LINUX SOFTWARE#
The system used to build the software will be called the build host, and the system for which the software is built will be called the target system or target platform. The FATAL_ERROR option is accepted but ignored by CMake 2.6 and higher. Cross-compiling a piece of software means that the software is built on one system, but is intended to run on a different system. which enables compatibility features for CMake 2.4 and lower.
Set the minimum required version of cmake for a project. txt file automatically and places it in the project root directory. When you create a new project, CLion generates CMakeLists.
txt file contains a set of directives and instructions describing the project’s source files and targets (executable, library, or both).