Well, it's a powerful tool that lets you set up your project in most of the popular IDEs and helps you a lot when building crossplatform applications.
Here's an example to work with SFML and CLion:
CMakeLists.txt (
Documentation)
cmake_minimum_required(VERSION 2.8)
project(forum CXX)
if(WIN32)
set(SFML_ROOT "$ENV{PROGRAMFILES(x86)}/SFML") # You will probably have to change this
endif(WIN32)
set(CMAKE_BUILD_TYPE Release) #If you have problems check if you have SFML debug libraries or release libraries
find_package(SFML 2.1 COMPONENTS system window graphics REQUIRED)
include_directories(${SFML_INCLUDE_DIR} ${PROJECT_SOURCE_DIR})
set(SOURCE_FILES main.cpp )
set(HEADER_FILES )
add_executable(forum ${SOURCE_FILES} ${HEADER_FILES})
target_link_libraries(forum ${SFML_LIBRARIES})
Your main.cpp
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode::getDesktopMode(), "Test");
while(window.isOpen())
{
sf::Event event;
while(window.pollEvent(event))
{
if(event.type == sf::Event::Closed)
window.close();
}
}
return 0;
}
YOU NEED THE DLLs TO RUN THE PROGRAM AFTER COMPILING IT!