Files
minecraft-clone/CMakeLists.txt
2020-07-19 16:16:27 +02:00

22 lines
884 B
CMake

project(minecraft-clone C)
cmake_minimum_required(VERSION 3.9)
set( CMAKE_EXPORT_COMPILE_COMMANDS ON )
include_directories(lib/glad/include lib/advanced_C_standard_liberary/include include lib/stb/include)
file(GLOB SOURCES "src/*.c" "lib/*/src/*.c")
find_program(CCACHE_PROGRAM ccache)
add_executable(test.out ${SOURCES})
set_property(TARGET test.out PROPERTY C_STANDARD 11)
if(CCACHE_PROGRAM)
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
endif()
set(OpenGL_GL_PREFERENCE GLVND)
find_package(OpenGL REQUIRED)
if(NOT OPENGL_FOUND)
message("ERROR: OpenGL not found")
endif(NOT OPENGL_FOUND)
set(GL_LIBRARY GL GLU X11)
target_include_directories(test.out PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_link_libraries(test.out PUBLIC glfw OpenGL::GL ${CMAKE_DL_LIBS})