Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: cmake
Fetching contributors…

Cannot retrieve contributors at this time

81 lines (63 sloc) 2.132 kB
project(VGL)
cmake_minimum_required(VERSION 2.6)
# External libraries that we use.
include(FindGLUT)
include(FindJPEG)
include(FindPNG)
include(FindOpenGL)
include(FindOpenMP)
include(FindTIFF)
# There's no ready-made CMake module for setting up cppunit, so it's DIY time...
find_library(CPPUNIT_LIBRARY cppunit)
if (CPPUNIT_LIBRARY STREQUAL "CPPUNIT_LIBRARY-NOTFOUND")
message(WARNING "Unable to find cppunit. Tests won't be built.")
set(CPPUNIT_FOUND 0)
else (CPPUNIT_LIBRARY STREQUAL "CPPUNIT_LIBRARY-NOTFOUND")
message(STATUS "Found cppunit: ${CPPUNIT_LIBRARY}")
set(CPPUNIT_FOUND 1)
endif (CPPUNIT_LIBRARY STREQUAL "CPPUNIT_LIBRARY-NOTFOUND")
# General build properties.
file(GLOB VGL_SOURCES src/*.cpp thirdparty/*.c)
file(GLOB VGL_HEADERS src/*.h)
file(GLOB VGL_EXTRAS test/*.cpp example/*.cpp)
# Compilation and linking properties.
set_source_files_properties(${VGL_SOURCES} ${VGL_EXTRAS}
COMPILE_FLAGS "${OpenMP_CXX_FLAGS}")
include_directories(src thirdparty
${GLUT_INCLUDE_DIR}
${JPEG_INCLUDE_DIR}
${PNG_INCLUDE_DIR}
${TIFF_INCLUDE_DIR})
# 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)
install(TARGETS ${example_NAME} DESTINATION bin)
endfunction(example)
# Helper function which creates a test program.
function (test test_NAME)
add_executable(${test_NAME} test/${test_NAME}.cpp)
target_link_libraries(${test_NAME} vgl ${CPPUNIT_LIBRARY})
add_test(NAME run-${test_NAME} COMMAND ${test_NAME})
endfunction(test)
# The VGL shared library.
add_library(vgl SHARED ${VGL_SOURCES} ${VGL_THIRDPARTY_SOURCES})
target_link_libraries(vgl
${OPENGL_LIBRARIES}
${GLUT_LIBRARIES}
${JPEG_LIBRARIES}
${PNG_LIBRARIES}
${TIFF_LIBRARIES})
install(FILES ${VGL_HEADERS} DESTINATION include)
install(TARGETS vgl LIBRARY DESTINATION lib)
# The unit tests.
if (CPPUNIT_FOUND)
enable_testing()
test(test_quaternion)
endif (CPPUNIT_FOUND)
# The example programs.
example(arcball)
example(basic)
example(example)
example(imageview)
example(styled)
Jump to Line
Something went wrong with that request. Please try again.