Skip to content

Instantly share code, notes, and snippets.

@izzyaxel
Created September 16, 2017 03:31
Show Gist options
  • Save izzyaxel/c3a245336231e58e3ce8fe06fad6e989 to your computer and use it in GitHub Desktop.
Save izzyaxel/c3a245336231e58e3ce8fe06fad6e989 to your computer and use it in GitHub Desktop.
cmake_minimum_required(VERSION 3.8.2)
project(projectname)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Wextra -Wpedantic")
include_directories(include)
set(SOURCE_FILES
cppfile hppfile)
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME}
${CMAKE_SOURCE_DIR}/libs/libsdl2/libSDL2.dll.a
etc)
configure_file(original/file output/path/file COPYONLY) # copy a file into the build directory
if(CMAKE_BUILD_TYPE MATCHES Release)
set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} -mwindows) # -mwindows prevents the command prompt from opening when you run the built EXE on windows
set(CMAKE_CXX_FLAGS_RELEASE "-Ofast")
else(CMAKE_BUILD_TYPE MATCHES Debug)
set(CMAKE_CXX_FLAGS_DEBUG "-ggdb3 -Og")
ADD_DEFINITIONS(-D_DEBUG) # A global define
endif()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment