diff --git a/CMakeLists.txt b/CMakeLists.txt index 5eb3b30..6dde0cf 100644 --- a/CMakeLists.txt +++ b/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)