PROJECT(assimp_simpleogl)
cmake_minimum_required(VERSION 3.13)
SET(SAMPLE_PROJECT_NAME assimp_simpleogl)

FIND_PACKAGE(assimp)
FIND_PACKAGE(OpenGL)
FIND_PACKAGE(GLUT)
IF ( MSVC )
  SET(M_LIB)
ELSE ()
  find_library(M_LIB m)
ENDIF ()

IF ( NOT GLUT_FOUND )
  MESSAGE( WARNING "Please install glut." )
ENDIF ()

# Used for usage and error messages in the program.
ADD_COMPILE_DEFINITIONS(ASSIMP_VERSION="<unknown>")
ADD_COMPILE_DEFINITIONS(PROJECT_NAME="${SAMPLE_PROJECT_NAME}")

if ( MSVC )
  ADD_DEFINITIONS( -D_SCL_SECURE_NO_WARNINGS )
  ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS )
endif ()

INCLUDE_DIRECTORIES(
  ${ASSIMP_INCLUDE_DIR}
  ${OPENGL_INCLUDE_DIR}
  ${GLUT_INCLUDE_DIR}
)

ADD_EXECUTABLE( ${SAMPLE_PROJECT_NAME}
  Sample_SimpleOpenGL.c
)

SET_PROPERTY(TARGET ${SAMPLE_PROJECT_NAME} PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})

TARGET_LINK_LIBRARIES( ${SAMPLE_PROJECT_NAME} assimp ${ASSIMP_LIBRARIES} ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${M_LIB} )
SET_TARGET_PROPERTIES( ${SAMPLE_PROJECT_NAME} PROPERTIES
  OUTPUT_NAME ${SAMPLE_PROJECT_NAME}
)
