FIND_PACKAGE(OpenGL REQUIRED)
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
LIST(APPEND LIBS ${OPENGL_gl_LIBRARY})
-LIST(APPEND LIBS m)
+
+# lib m for math, not needed on windows
+IF (NOT WIN32)
+ LIST(APPEND LIBS m)
+ENDIF()
IF(WIN32)
MESSAGE(WARNING "Insecure CRT warnings hidden (might want to fix these)")
SET_TARGET_PROPERTIES(freeglut PROPERTIES VERSION 3.9.0 SOVERSION 3 OUTPUT_NAME glut)
SET_TARGET_PROPERTIES(freeglut_static PROPERTIES OUTPUT_NAME glut)
ENDIF()
-TARGET_LINK_LIBRARIES(freeglut ${LIBS})
-TARGET_LINK_LIBRARIES(freeglut_static ${LIBS})
+IF(BUILD_SHARED_LIBS)
+ TARGET_LINK_LIBRARIES(freeglut ${LIBS})
+ENDIF()
+IF(BUILD_STATIC_LIBS)
+ TARGET_LINK_LIBRARIES(freeglut_static ${LIBS})
+ENDIF()
IF(BUILD_SHARED_LIBS)
INSTALL(TARGETS freeglut DESTINATION lib)
option( FREEGLUT_BUILD_DEMOS "Build FreeGLUT demos." ON )
SET(DEMO_LIBS ${OPENGL_glu_LIBRARY} ${LIBS})
-LIST(APPEND DEMO_LIBS m)
+# lib m for math, not needed on windows
+IF (NOT WIN32)
+ LIST(APPEND DEMO_LIBS m)
+ENDIF()
MACRO(ADD_DEMO name)
- if( FREEGLUT_BUILD_DEMOS )
- ADD_EXECUTABLE(${name} ${ARGN})
- IF(BUILD_SHARED_LIBS)
- TARGET_LINK_LIBRARIES(${name} ${DEMO_LIBS} freeglut)
- ELSE()
- TARGET_LINK_LIBRARIES(${name} ${DEMO_LIBS} freeglut_static)
- ENDIF()
- endif()
+ IF( FREEGLUT_BUILD_DEMOS )
+ IF(BUILD_SHARED_LIBS)
+ ADD_EXECUTABLE(${name} ${ARGN})
+ TARGET_LINK_LIBRARIES(${name} ${DEMO_LIBS} freeglut)
+ ENDIF()
+ IF(BUILD_STATIC_LIBS)
+ ADD_EXECUTABLE(${name}_static ${ARGN})
+ TARGET_LINK_LIBRARIES(${name}_static ${DEMO_LIBS} freeglut_static)
+ ENDIF()
+ ENDIF()
ENDMACRO()
ADD_DEMO(CallbackMaker progs/demos/CallbackMaker/CallbackMaker.c)