Vision and Security Technology Lab
First of all in order to use
CMake you must download it from their
website.
Next you must create a CMakeLists.txt file. (My CMakeLists.txt file can be found
here) This is described in great detail on the CMake website. For my project The major issue was that
most computers on the UCCS campus that had Visual Studio didn't have OpenGL or Glut installed correctly. And not all computers had the same
version of Visual Studio. However that only helps me when I am on campus. At home I use Linux and there is a whole different build system.
In order to make my code as portable as I could so I can compile at campus and at home I created a directory structure like the one below. I
created this directory structure on my network drive at campus in Z:\Data\opengl.
Z:\Data\opengl == Root
\bin
|-\linux
|-\vs6
|-\vs2003
|-\vs2005
\include
|-GL
|-GL.h
|-GLU.h
|-glut.h
\lib
|-GLU32.DLL
|-GLU32.LIB
|-GLUT32.DLL
|-Glut32.lib
|-glut.dll
|-glut.lib
|-OPENGL32.DLL
|-OPENGL32.LIB
\src
|-(all .cpp and .h files)
|-CMakeLists.txt
You can create your own CMakeLists.txt file or you can download
mine. Once you have everything in place and have edited
the CMakeLists.txt file (even if you downloaded mine there are some customizations you need to make, see the top of the CMakeLists.txt file for more information)
you need to run CMake.
Windows
You can install the cmake application to a network drive if you don't have administrative permissions on a computer, just ignore the
errors. Once installed run CMake, you might have to navigate to the directory where you installed it then inside the bin directory there is a CMakeSetup.exe run that.
Click on browse next to the question where is the source code, navigate to your \src directory in your directory tree mentioned above. Now click on the browse next
to where to build the binaries. Navigate to the appropriate Visual Studio folder under the \bin directory mentioned above. Click configure. Unless you get errors you
are good, you need to get rid of the red Cache Values listed. Click on the configure button a second time to do this. If everything turns grey and you don't get any errors
click on ok. Now in the directory you told it to build the binaries in you should find a visual studio project.
Linux
So you have the CMakeLists.txt file all configured and you have a directory tree somewhat like the one above mine is in /home/nniehoff/opengl. You should have OpenGL and Glut
libraries installed on your system. Also you will need to install CMake, check
http://www.cmake.org for more information. I leave it up to
you to install the appropriate stuff. Next issue the following two commands:
cd /home/nniehoff/opengl/bin/linux <== Obviously this needs to be where your bin/linux directory is
cmake ../../src/
That should generate a Makefile now run make and you should be good to go. There are other options for cmake on linux to generate files for
kdevelop and other development tools as well.