0% found this document useful (0 votes)
14 views1 page

CMake Lists

This CMake configuration file sets up a project named AntSimulator with a minimum required version of CMake 3.10 and defaults to a release build. It finds the necessary SFML components and links them to the executable, while also handling platform-specific settings for Windows and Unix. Additionally, it copies resource files and SFML libraries to the binary directory during the build process.

Uploaded by

muhammeterguven1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views1 page

CMake Lists

This CMake configuration file sets up a project named AntSimulator with a minimum required version of CMake 3.10 and defaults to a release build. It finds the necessary SFML components and links them to the executable, while also handling platform-specific settings for Windows and Unix. Additionally, it copies resource files and SFML libraries to the binary directory during the build process.

Uploaded by

muhammeterguven1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

cmake_minimum_required(VERSION 3.

10)
project(AntSimulator VERSION 1.0.0 LANGUAGES CXX)

# Default to release builds


if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()

find_package(SFML 2 REQUIRED COMPONENTS graphics system window)


find_package(Threads REQUIRED)

if(WIN32)
set(WIN32_GUI WIN32)
endif()

set(SFML_LIBS sfml-graphics sfml-system sfml-window)

file(GLOB SOURCES src/*.cpp)


add_executable(${PROJECT_NAME} ${WIN32_GUI} ${SOURCES})
target_include_directories(${PROJECT_NAME} PRIVATE "include" "lib")
set(SFML_LIBS sfml-system sfml-window sfml-graphics)
target_link_libraries(${PROJECT_NAME} ${SFML_LIBS})
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17)
if (UNIX)
target_link_libraries(${PROJECT_NAME} pthread)
endif (UNIX)

# Copy res dir to the binary directory


file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/res DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

if(MSVC)
foreach(lib ${SFML_LIBS})
get_target_property(lib_path ${lib} LOCATION)
file(COPY ${lib_path} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
endforeach()
endif()

You might also like