Browse files

Got a basic CMake build working.

It doesn't nicely separate out the build results yet though - the vgl library, the examples and the tests all get built into the same folder - and it doesn't copy the headers out either.

It doesn't use any fancy compiler or linker options either yet, besides those necessary to get it building at all.
  • Loading branch information...
1 parent cc9d249 commit a891898bc13417f2c162bcc7edf0ba0c6825272b @vilya committed Aug 24, 2010
Showing with 58 additions and 0 deletions.
  1. +58 −0 CMakeLists.txt
@@ -0,0 +1,58 @@
+cmake_minimum_required(VERSION 2.6)
+# General build properties
+file(GLOB VGL_SOURCES src/*.cpp thirdparty/*.c)
+file(GLOB VGL_HEADERS src/*.h)
+include_directories(src thirdparty /opt/local/include)
+# 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})
+ install(TARGETS ${example_NAME} DESTINATION bin)
+# 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)
+ 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})
+# The VGL shared library
+if (${APPLE})
+ target_link_libraries(vgl png jpeg tiff)
+ set_target_properties(vgl PROPERTIES LINK_FLAGS "-framework OpenGL -framework GLUT")
+ target_link_libraries(vgl glut pthread png jpeg tiff)
+install(FILES ${VGL_HEADERS} DESTINATION dist/include)
+install(TARGETS vgl LIBRARY DESTINATION dist/lib)
+# The unit test programs
+# The example programs

0 comments on commit a891898

Please sign in to comment.