-# Installation of library and headers.
-include(GNUInstallDirs)
-install(TARGETS IrrlichtMt
- EXPORT IrrlichtMt-export
- DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+option(BUILD_EXAMPLES "Build example applications" FALSE)
+if(BUILD_EXAMPLES)
+ add_subdirectory(examples)
+endif()
+
+# Export a file that describes the targets that IrrlichtMt creates.
+# The file is placed in the location FILE points to, where CMake can easily
+# locate it by pointing CMAKE_PREFIX_PATH to this project root.
+export(EXPORT IrrlichtMt-export
+ FILE "${CMAKE_CURRENT_BINARY_DIR}/cmake/IrrlichtMtTargets.cmake"
+ NAMESPACE IrrlichtMt::