initial
This commit is contained in:
44
CMakeLists.txt
Normal file
44
CMakeLists.txt
Normal file
@@ -0,0 +1,44 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(Minesweeper)
|
||||
|
||||
# Set C++ standard
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Find SFML package
|
||||
find_package(SFML 2.5 COMPONENTS graphics window system REQUIRED)
|
||||
|
||||
# Create assets directory if it doesn't exist
|
||||
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/assets)
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/assets)
|
||||
endif()
|
||||
|
||||
# Add executable
|
||||
add_executable(Minesweeper
|
||||
src/main.cpp
|
||||
)
|
||||
|
||||
# Link SFML libraries
|
||||
target_link_libraries(Minesweeper
|
||||
sfml-graphics
|
||||
sfml-window
|
||||
sfml-system
|
||||
)
|
||||
|
||||
# Copy assets to build directory (for out-of-source builds)
|
||||
add_custom_command(TARGET Minesweeper POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/assets
|
||||
$<TARGET_FILE_DIR:Minesweeper>/assets
|
||||
COMMENT "Copying assets to build directory"
|
||||
)
|
||||
|
||||
# Install target (optional)
|
||||
install(TARGETS Minesweeper
|
||||
RUNTIME DESTINATION bin
|
||||
)
|
||||
|
||||
# Install assets (optional)
|
||||
install(DIRECTORY assets/
|
||||
DESTINATION share/Minesweeper
|
||||
)
|
||||
Reference in New Issue
Block a user