Turned Makefile into CMake
This commit is contained in:
parent
fb672c7ddb
commit
a8cc2d1174
15
CMakeLists.txt
Normal file
15
CMakeLists.txt
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
|
project(
|
||||||
|
snakeplusplus
|
||||||
|
LANGUAGES CXX)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 11 CACHE STRING "The C++ standard to use")
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||||
|
|
||||||
|
include_directories(${snakeplusplus_SOURCE_DIR}/src)
|
||||||
|
|
||||||
|
add_subdirectory(src)
|
||||||
|
|
22
Makefile
22
Makefile
@ -1,22 +0,0 @@
|
|||||||
INC := -I include
|
|
||||||
STD := -std=c++11
|
|
||||||
SFML := -lsfml-graphics -lsfml-window -lsfml-system
|
|
||||||
|
|
||||||
all: compile link
|
|
||||||
|
|
||||||
fresh: dirs compile link
|
|
||||||
|
|
||||||
compile:
|
|
||||||
g++ $(INC) $(STD) -c -o build/main.o src/main.cpp
|
|
||||||
g++ $(INC) $(STD) -c -o build/playerinterface.o src/playerinterface.cpp
|
|
||||||
g++ $(INC) $(STD) -c -o build/gamestate.o src/gamestate.cpp
|
|
||||||
g++ $(INC) $(STD) -c -o build/snake.o src/snake.cpp
|
|
||||||
|
|
||||||
dirs:
|
|
||||||
mkdir bin build
|
|
||||||
|
|
||||||
link:
|
|
||||||
g++ build/*.o -o bin/SnakePlusPlus.out $(SFML)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm bin/*.out build/*.o
|
|
13
src/CMakeLists.txt
Normal file
13
src/CMakeLists.txt
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
find_package(SFML COMPONENTS graphics window system REQUIRED)
|
||||||
|
|
||||||
|
add_executable(snakeplusplus
|
||||||
|
./main.cpp
|
||||||
|
./gamestate.cpp
|
||||||
|
./snake.cpp
|
||||||
|
./playerinterface.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(snakeplusplus PUBLIC ${CMAKE_CURRENT_LIST_DIR})
|
||||||
|
|
||||||
|
target_link_libraries(snakeplusplus sfml-graphics)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user