Skip to content

Instantly share code, notes, and snippets.

@skorezore
Created August 1, 2015 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skorezore/fcd64cb1902e5bd5b331 to your computer and use it in GitHub Desktop.
Save skorezore/fcd64cb1902e5bd5b331 to your computer and use it in GitHub Desktop.
cmake_minimum_required (VERSION 2.8.12)
project (Bugfree)
# Compiler flags
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC)
add_compile_options (-static)
set (CMAKE_CXX_FLAGS "-std=c++14")
endif (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC)
if (MSVC)
add_compile_options (/MT)
endif (MSVC)
# Add files
file (GLOB bugfree_source ${CMAKE_CURRENT_SOURCE_DIR}/Source/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Source/*.hpp)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Source)
add_executable (Bugfree ${bugfree_source})
# Options
set (BUILD_SHARED_LIBS OFF CACHE BOOL "")
# Link GLAD
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/glad)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/glad/include)
target_link_libraries (Bugfree glad)
# GLFW Options
set (GLFW_BUILD_DOCS FALSE CACHE BOOL "")
set (GLFW_BUILD_EXAMPLES FALSE CACHE BOOL "")
set (GLFW_BUILD_TESTS FALSE CACHE BOOL "")
# Link GLFW
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/glfw-3.1.1)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/glfw-3.1.1/include)
target_link_libraries (Bugfree glfw ${GLFW_LIBRARIES}) # This links OpenGL amd GLFW's other dependencies.
set (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Binaries)
# Include GLM
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/glm-0.9.6.3)
# Include STB
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/stb)
# Link tinyobjloader
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/tinyobjloader)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/tinyobjloader)
target_link_libraries (Bugfree tinyobjloader)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment