Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
FantasyRPG/CMakeLists.txt
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
44 lines (31 sloc)
1.95 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[[ CMake references - https://www.youtube.com/playlist?list=PLK6MXr8gasrGmIiSuVQXpfFuE1uPT615s ]] | |
#[[ Navigate to ./build/ folder and run `cmake ..` to configure the project, | |
then `cmake --build .` to build it. ]] | |
# Minimum CMake version - can be set to (VERSION x ... y) to allow range of versions | |
cmake_minimum_required(VERSION 3.17) # This project has only been tested on 3.19.4 | |
# Set project name, version, description and code language | |
project(FantasyRPG VERSION 1.0 | |
DESCRIPTION "Fantasy role playing game for 4007CEM - Activity Led Learning Project. Faisal Al Dulaimy, James Askew, Sophia Dukhota, Kurtis Ebanks, Jaanus Koppel" | |
LANGUAGES CXX) | |
#[[ To compile project which is split across multiple folders, the sub-directories must be added here. | |
add_subdirectory(<name of folder>) ]] | |
add_subdirectory(src) | |
add_subdirectory(tests) | |
target_include_directories(display PUBLIC "${CMAKE_SOURCE_DIR}/src") | |
#[[ Have executable files written into a specific folder. Building in debug or release mode will create sub-folders. | |
${CMAKE_SOURCE_DIR} - top level of CMake source tree | |
/bin - desired folder relative to the above location ]] | |
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) | |
#[[ Add executable details | |
add_executable(<name of executable> <source file> <more source files if needed>) | |
(header files can be listed for visibility but are ignored) ]] | |
add_executable(main main.cpp) | |
#[[ Libraries must be linked into executable otherwise they will not be included. | |
target_link_libraries(<CMake target> <desired library> <more libraries if needed>) | |
e.g: target_link_libraries(game creatures items creatures) ]] | |
target_link_libraries(main display) | |
# target_link_libraries(workshop container placeholders) # comment out this line if it hasn't already been | |
# add_executable(window src/display/main.cpp) | |
# target_link_libraries(window display) | |
# Use CMake's testing tool - CTest | |
include(CTest) |