Skip to content
Permalink
master
Switch branches/tags

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?
Go to file
 
 
Cannot retrieve contributors at this time
cmake_minimum_required(VERSION 3.0)
set(CMAKE_CXX_STANDARD 14)
project(cppintro CXX)
# turns out that g++ will allow variable length arrays but I
# dont' want students getting dependant on non-standard features
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wvla -Werror=vla")
# limit number of errors shown to 1
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wfatal-errors")
# config directories
include_directories(${CMAKE_SOURCE_DIR})
# add tests
enable_testing()
add_subdirectory(Testing)
add_subdirectory(Lecture)
# tell cmake where to put the executables that it creates
# also creates the directory if needed
file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin )
# tell cmake where to put the libraries that it creates
# also creates the directory if needed
file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
# compile the hangman code into a shared library
add_library(Hangman SHARED lab_hangman.cpp)
target_include_directories(Hangman INTERFACE ${CMAKE_SOURCE_DIR})
# compile the command line version of hangman
add_executable(Game playgame.cpp)
target_link_libraries(Game Hangman)