| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- # Copyright (C) 2018 Tomasz Gałaj
- cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
- project(opengltest)
- # Add .lib files
- link_directories(${CMAKE_SOURCE_DIR}/lib)
- # Add source files
- file(GLOB_RECURSE SOURCE_FILES
- ${CMAKE_SOURCE_DIR}/src/*.c
- ${CMAKE_SOURCE_DIR}/src/*.cpp
- main.cpp)
-
- # Add header files
- file(GLOB_RECURSE HEADER_FILES
- ${CMAKE_SOURCE_DIR}/src/*.h
- ${CMAKE_SOURCE_DIR}/src/*.hpp)
- # Configure assets header file
- include_directories(${CMAKE_BINARY_DIR}/src)
-
- # Define the executable
- add_executable(opengltest ${HEADER_FILES} ${SOURCE_FILES})
- # We need a CMAKE_DIR with some code to find external dependencies
- set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
- #######################################
- # LOOK for the packages that we need! #
- #######################################
- # OpenGL
- find_package(OpenGL REQUIRED)
- # GLUT
- find_package(GLUT REQUIRED)
- message(STATUS "GLUT included at ${GLUT_INCLUDE_DIRS}")
- # Put all libraries into a variable
- set(LIBS ${OPENGL_LIBRARIES} ${GLUT_LIBRARY})
- # Define the include DIRs
- include_directories(
- "${CMAKE_SOURCE_DIR}/src"
- "${CMAKE_SOURCE_DIR}/include"
- )
- # Define the link libraries
- target_link_libraries(${PROJECT_NAME} ${LIBS})
|