<div class="gmail_quote">On Thu, Feb 19, 2009 at 8:36 PM, Andrea Tagliasacchi <span dir="ltr">&lt;<a href="mailto:ata2@cs.sfu.ca">ata2@cs.sfu.ca</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Thanks Philip, <br><br>that worked flawlessly!<br><br>I would say that <b>this</b> is the most compact CMake specification to compile <br>a Glut/OpenGL application then:<br><br><b><div class="Ih2E3d">find_package(GLUT)<br>
find_package(OpenGL)<br></div>
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})<div class="Ih2E3d"><br>ADD_EXECUTABLE(mesh_view mesh_view.cpp)<br></div>TARGET_LINK_LIBRARIES(mesh_view ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES}) </b></blockquote><div><br>Yes, that&#39;s pretty much all you should need to get started.<br>
<br>You might want to consider adding the REQUIRED keyword to the find_package() command if the package is absolutely essential to compiling your entire project.&nbsp; It should yield a far more useful error message if the package is not found.<br>
<br>If you don&#39;t declare a package REQUIRED, a good rule of thumb is to use conditionals keyed on the CMake module&#39;s found variable (e.g OPENGL_FOUND ) to control where you use it.<br><b><br>find_package(Foo)<br>if(FOO_FOUND)<br>
&nbsp;&nbsp; include_directories(${FOO_INCLUDE_DIR})<br>endif()<br></b></div></div><br>-- <br>Philip Lowman<br>