CMakeLists.txt 1.12 KiB
cmake_minimum_required(VERSION 3.12)
project(Pacman)
set(CMAKE_CXX_STANDARD 17)
file(GLOB_RECURSE SOURCES source/*.cpp)
if (APPLE AND CMAKE_BUILD_TYPE STREQUAL "Release")
    set(MACOSX_BUNDLE TRUE)
    set(MACOSX_BUNDLE_BUNDLE_NAME "Pacman")
    set(MACOSX_BUNDLE_GUI_IDENTIFIER "dpechenin")
    set(MACOSX_BUNDLE_BUNDLE_VERSION "1.0")
    set(MACOSX_BUNDLE_SHORT_VERSION_STRING "1.0")
endif()
set(SFML_STATIC_LIBRARIES TRUE)
set(BUILD_SHARED_LIBS FALSE)
include(FetchContent)
FetchContent_Declare(SFML GIT_REPOSITORY https://github.com/SFML/SFML.git GIT_TAG 2.6.1)
FetchContent_MakeAvailable(SFML)
add_executable(${PROJECT_NAME} MACOSX_BUNDLE ${SOURCES})
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_SOURCE_DIR}/source)
target_compile_definitions(${PROJECT_NAME} PUBLIC ASSETS_PATH="${CMAKE_CURRENT_SOURCE_DIR}/assets/")
target_link_libraries(${PROJECT_NAME} PRIVATE sfml-system sfml-window sfml-graphics)
if (APPLE AND CMAKE_BUILD_TYPE STREQUAL "Release")
    set_source_files_properties(assets/icon.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
    target_sources(${PROJECT_NAME} PRIVATE assets/icon.icns)
endif()