don't have GLUT find module look for the DLL

This commit is contained in:
Stephen Birarda 2014-03-07 14:47:24 -08:00
parent ec450315cd
commit 6f81803a3d
2 changed files with 6 additions and 19 deletions

View file

@ -4,14 +4,14 @@
# GLUT_FOUND
# GLUT_INCLUDE_DIR
# GLUT_LIBRARIES
# GLUT_DLL_PATH - Optionally defined for Win32
# GLUT_DLL_PATH - Optionally defined for Win32, if not in path
#
# Created on 2/6/2014 by Stephen Birarda
#
# Adapted from FindGLUT.cmake available in tlorach's OpenGLText Repository
# https://raw.github.com/tlorach/OpenGLText/master/cmake/FindGLUT.cmake
if (GLUT_INCLUDE_DIR AND GLUT_LIBRARIES AND (NOT WIN32 OR GLUT_DLL_PATH))
if (GLUT_INCLUDE_DIR AND GLUT_LIBRARIES)
set(GLUT_FOUND TRUE)
else ()
if (WIN32)
@ -23,7 +23,6 @@ else ()
endif()
find_library(GLUT_glut_LIBRARY freeglut PATH_SUFFIXES lib/${WIN_ARCH_DIR} HINTS ${WIN_GLUT_SEARCH_DIRS})
find_path(GLUT_DLL_PATH freeglut.dll PATH_SUFFIXES bin/${WIN_ARCH_DIR} HINTS ${WIN_GLUT_SEARCH_DIRS})
else ()
find_path(GLUT_INCLUDE_DIR GL/glut.h
"${GLUT_LOCATION}/include"
@ -71,12 +70,7 @@ else ()
endif ()
include(FindPackageHandleStandardArgs)
if (WIN32)
find_package_handle_standard_args(GLUT DEFAULT_MSG GLUT_INCLUDE_DIR GLUT_LIBRARIES GLUT_DLL_PATH)
else ()
find_package_handle_standard_args(GLUT DEFAULT_MSG GLUT_INCLUDE_DIR GLUT_LIBRARIES)
endif()
find_package_handle_standard_args(GLUT DEFAULT_MSG GLUT_INCLUDE_DIR GLUT_LIBRARIES)
if (GLUT_FOUND)
if (NOT GLUT_FIND_QUIETLY)

View file

@ -228,15 +228,8 @@ else (APPLE)
# link target to external libraries
if (WIN32)
find_package(GLEW REQUIRED)
include_directories(${GLEW_INCLUDE_DIRS})
target_link_libraries(${TARGET_NAME} "${GLEW_LIBRARY}" wsock32.lib opengl32.lib)
# have CMake copy the dlls for GLUT and GLEW as a post build step
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${GLUT_DLL_PATH}/freeglut.dll
$<TARGET_FILE_DIR:${TARGET_NAME}>
)
find_package(GLEW REQUIRED)
include_directories(${GLEW_INCLUDE_DIRS})
target_link_libraries(${TARGET_NAME} "${GLEW_LIBRARY}" wsock32.lib opengl32.lib)
endif()
endif (APPLE)