Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Better handling for the library-vs.-framework issue for OpenGL and GLUT.

Using find_library now which does the right thing regardless of which OS we're building on (I think - I haven't been able to test it on Linux yet).
  • Loading branch information...
commit 79cdf9c2e872ca3ad789171395b719d32dc3efeb 1 parent a891898
@vilya authored
Showing with 4 additions and 13 deletions.
  1. +4 −13 CMakeLists.txt
View
17 CMakeLists.txt
@@ -5,6 +5,8 @@ cmake_minimum_required(VERSION 2.6)
# General build properties
file(GLOB VGL_SOURCES src/*.cpp thirdparty/*.c)
file(GLOB VGL_HEADERS src/*.h)
+find_library(OpenGL_LIB OpenGL gl)
+find_library(GLUT_LIB GLUT glut)
include_directories(src thirdparty /opt/local/include)
link_directories(/opt/local/lib)
@@ -13,10 +15,7 @@ link_directories(/opt/local/lib)
# Helper function which creates an example program.
function (example example_NAME)
add_executable(${example_NAME} example/${example_NAME}.cpp)
- target_link_libraries(${example_NAME} vgl ${VGL_LIBS})
- if (${APPLE})
- set_target_properties(${example_NAME} PROPERTIES LINK_FLAGS "-framework OpenGL -framework GLUT")
- endif(${APPLE})
+ target_link_libraries(${example_NAME} vgl)
install(TARGETS ${example_NAME} DESTINATION bin)
endfunction(example)
@@ -24,9 +23,6 @@ endfunction(example)
function (test test_NAME)
add_executable(${test_NAME} test/${test_NAME}.cpp)
target_link_libraries(${test_NAME} vgl cppunit)
- if (${APPLE})
- set_target_properties(${test_NAME} PROPERTIES LINK_FLAGS "-framework OpenGL -framework GLUT")
- endif(${APPLE})
install(TARGETS ${test_NAME} DESTINATION bin)
add_test(NAME run-${test_NAME} COMMAND ${test_NAME})
endfunction(test)
@@ -34,12 +30,7 @@ endfunction(test)
# The VGL shared library
add_library(vgl SHARED ${VGL_SOURCES} ${VGL_THIRDPARTY_SOURCES})
-if (${APPLE})
- target_link_libraries(vgl png jpeg tiff)
- set_target_properties(vgl PROPERTIES LINK_FLAGS "-framework OpenGL -framework GLUT")
-else(${APPLE})
- target_link_libraries(vgl glut pthread png jpeg tiff)
-endif(${APPLE})
+target_link_libraries(vgl ${OpenGL_LIB} ${GLUT_LIB} pthread png jpeg tiff)
install(FILES ${VGL_HEADERS} DESTINATION dist/include)
install(TARGETS vgl LIBRARY DESTINATION dist/lib)
Please sign in to comment.
Something went wrong with that request. Please try again.