-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
55 lines (46 loc) · 1.51 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
cmake_minimum_required(VERSION 3.22.0)
set(CMAKE_CXX_STANDARD 17)
set(SFML_VERSION "2.6.1")
set(BIN_PATH_NAME "bin")
set(RESOURCES_PATH_NAME "resources")
set(CMAKE_INSTALL_PREFIX "install")
set(CMAKE_INSTALL_RPATH "../lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${BIN_PATH_NAME})
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
project(minesweeper LANGUAGES CXX VERSION 1.0)
include(FetchContent)
FetchContent_Declare(SFML
GIT_REPOSITORY https://github.com/SFML/SFML.git
GIT_TAG ${SFML_VERSION})
FetchContent_MakeAvailable(SFML)
add_executable(${PROJECT_NAME}
Cell.hpp
Controller.hpp
Controller.cpp
Model.hpp
Model.cpp
View.hpp
View.cpp
Main.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE
sfml-graphics
sfml-window)
if (CMAKE_COMPILER_IS_GNUCXX)
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -Werror)
elseif(MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE -W4)
endif()
if(WIN32)
add_custom_command(
TARGET ${PROJECT_NAME}
COMMENT "Copy OpenAL DLL"
PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${SFML_SOURCE_DIR}/extlibs/bin/$<IF:$<EQUAL:${CMAKE_SIZEOF_VOID_P},8>,x64,x86>/openal32.dll $<TARGET_FILE_DIR:${PROJECT_NAME}>VERBATIM)
endif()
install(TARGETS ${PROJECT_NAME} DESTINATION ${BIN_PATH_NAME})
install(DIRECTORY ${RESOURCES_PATH_NAME} DESTINATION .)
include(InstallRequiredSystemLibraries)
set(CPACK_GENERATOR "ZIP")
set(CPACK_SOURCE_GENERATOR "ZIP")
include(CPack)