Exposing SMTK for use in external projects¶
SMTK generates a file named SMTKConfig.cmake
that allows other projects to find and use SMTK.
This file is installed to $CMAKE_INSTALL_PREFIX/lib/cmake/SMTK/
.
External projects can add SMTK with
find_package(SMTK)
Then, when building external projects, set CMake’s SMTK_DIR
to the directory containing SMTKConfig.cmake
.
Note that you may point external projects to the top level of an SMTK build directory or
an install tree’s lib/cmake/SMTK
directory; both contain an SMTKConfig.cmake
file
suitable for use by external projects.
The former is suitable for development, since you may be modifying both SMTK and a project
that depends on it — having to re-install SMTK after each change becomes tedious.
The latter is suitable for creating packages and distributing software.
If you add a new dependency to SMTK, CMake/smtkConfig.cmake.in
(which is used to create
SMTKConfig.cmake
) should be configured to find the dependent package so that consumers
of SMTK have access to it without additional work.
If you add a new option to SMTK, it should be exposed in CMake/Options.h.in
.