# Using CMake with Open Inventor Example Programs

See the Readme.txt in `$OIVHOME\Examples` for more information. This is a subset.

On Linux and MacOS, project files for Open Inventor example programs must be
generated on the host computer using the **CMake** tool. On Microsoft Windows,
ready-to-use Visual Studio project files are delivered with the Open Inventor
SDK, but CMake can also be used.

* Note that Visual Studio project files are _not_ provided for example programs
  that require Qt. For these programs you must use CMake.

The "generic" CMakeLists.txt file in this directory can be used to quickly create
project files for any Open Inventor example program including the ones that depend
on Qt. The resulting project files build the executable in a sub-directory below
the project directory and do not modify any files provided with the SDK.

We call it the "generic" CMakeLists.txt because, by default it pulls in all
the source files in the same directory and creates a project with the generic
name "OIV_Example".  This generic behavior is very convenient for modifying and
rebuilding multiple example programs. You can simply copy the files for any
Open Inventor example into a directory, replace the specific CMakeLists.txt
with the generic one, re-run CMake and build the resulting project.

- Note: This feature uses the CMake _glob_ mechanism, which is
  not recommended for real projects.  Comments in the file explain how to
  customize it for specific project files in the more usual CMake way.

The generic CMakeLists.txt file is also useful as an example for adding Open
Inventor support to your own CMake files or as a starting point for creating
CMake files for an Open Inventor project. This file shows how to compile with
the Open Inventor header files and link with the Open Inventor libraries using
the CMake command _find_package_.  It also shows how to (optionally) combine
Open Inventor with Qt.
