Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Using the FindOpenGL and FindOpenMP modules for CMake.

This automatically gives you the correct command line arguments for compiling and linking with OpenGL and OpenMP respectively.
  • Loading branch information...
commit 3d77a791d1b1424c1b2ef7425a41f6c53a527d1a 1 parent 79cdf9c
@vilya authored
Showing with 8 additions and 2 deletions.
  1. +8 −2 CMakeLists.txt
View
10 CMakeLists.txt
@@ -1,12 +1,17 @@
project(VGL)
cmake_minimum_required(VERSION 2.6)
+include(FindOpenGL)
+include(FindOpenMP)
# General build properties
file(GLOB VGL_SOURCES src/*.cpp thirdparty/*.c)
file(GLOB VGL_HEADERS src/*.h)
-find_library(OpenGL_LIB OpenGL gl)
+file(GLOB VGL_EXTRAS test/*.cpp example/*.cpp)
+
+#find_library(OpenGL_LIB OpenGL gl)
find_library(GLUT_LIB GLUT glut)
+set_source_files_properties(${VGL_SOURCES} ${VGL_EXTRAS} COMPILE_FLAGS "${OpenMP_CXX_FLAGS}")
include_directories(src thirdparty /opt/local/include)
link_directories(/opt/local/lib)
@@ -30,7 +35,8 @@ endfunction(test)
# The VGL shared library
add_library(vgl SHARED ${VGL_SOURCES} ${VGL_THIRDPARTY_SOURCES})
-target_link_libraries(vgl ${OpenGL_LIB} ${GLUT_LIB} pthread png jpeg tiff)
+#target_link_libraries(vgl ${OpenGL_LIB} ${GLUT_LIB} pthread png jpeg tiff)
+target_link_libraries(vgl ${OPENGL_LIBRARIES} ${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.