TP-rendu/TP1-2/CMakeLists.txt
2023-06-22 20:30:57 +02:00

44 lines
2.1 KiB
CMake
Executable file

cmake_minimum_required(VERSION 3.10)
project(tp1 VERSION 2021.0.0 LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 11)
# set(OpenGL_GL_PREFERENCE "GLVND")
find_package(OpenGL REQUIRED)
message(STATUS "OPENGL_gl_LIBRARY: ${OPENGL_gl_LIBRARY}")
if(MSVC)
set(GLUT_ROOT_PATH "${CMAKE_SOURCE_DIR}/freeglut")
message(STATUS "GLUT_ROOT_PATH: ${GLUT_ROOT_PATH}")
endif()
find_package(GLUT REQUIRED)
message(STATUS "GLUT_FOUND: ${GLUT_FOUND}")
message(STATUS "GLUT_INCLUDE_DIR: ${GLUT_INCLUDE_DIR}")
message(STATUS "GLUT_LIBRARIES: ${GLUT_LIBRARIES}")
if(APPLE)
add_definitions(-Wno-deprecated-declarations)
endif()
add_executable(helloteapot helloteapot.cpp)
target_include_directories(helloteapot PUBLIC ${OPENGL_INCLUDE_DIR} ${GLUT_INCLUDE_DIR})
#target_link_libraries(helloteapot PUBLIC ${OPENGL_opengl_LIBRARY} ${OPENGL_glu_LIBRARY} ${GLUT_LIBRARIES})
target_link_libraries(helloteapot PUBLIC OpenGL::GL OpenGL::GLU ${GLUT_LIBRARIES})
# Uncomment the following lines (remove the #) to add the helloteapot2.cpp to the build system
# add_executable(helloteapot2 helloteapot2.cpp)
# target_include_directories(helloteapot2 PUBLIC ${OPENGL_INCLUDE_DIR} ${GLUT_INCLUDE_DIR})
# # target_link_libraries(helloteapot2 PUBLIC ${OPENGL_opengl_LIBRARY} ${OPENGL_glu_LIBRARY} ${GLUT_LIBRARIES})
# target_link_libraries(helloteapot2 PUBLIC OpenGL::GL OpenGL::GLU ${GLUT_LIBRARIES})
add_executable(moreteapots moreteapots.cpp)
target_include_directories(moreteapots PUBLIC ${OPENGL_INCLUDE_DIR} ${GLUT_INCLUDE_DIR})
#target_link_libraries(moreteapots PUBLIC ${OPENGL_opengl_LIBRARY} ${OPENGL_glu_LIBRARY} ${GLUT_LIBRARIES})
target_link_libraries(moreteapots PUBLIC OpenGL::GL OpenGL::GLU ${GLUT_LIBRARIES})
# Uncomment the following lines (remove the #) to add the navigator to the build system (after having added the navigator.cpp)
add_executable(navigator navigator.cpp)
target_include_directories(navigator PUBLIC ${OPENGL_INCLUDE_DIR} ${GLUT_INCLUDE_DIR})
# target_link_libraries(navigator PUBLIC ${OPENGL_opengl_LIBRARY} ${OPENGL_glu_LIBRARY} ${GLUT_LIBRARIES})
target_link_libraries(navigator PUBLIC OpenGL::GL OpenGL::GLU ${GLUT_LIBRARIES})