From 8f5473fd8a38f70d1322136e73fbb67a1ca505d3 Mon Sep 17 00:00:00 2001 From: Timo Suoranta Date: Sat, 29 May 2021 17:09:01 +0300 Subject: [PATCH] Documentation for CMake FetchContent support --- manual/tracy.tex | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/manual/tracy.tex b/manual/tracy.tex index 202f77c6..daa27be3 100644 --- a/manual/tracy.tex +++ b/manual/tracy.tex @@ -389,6 +389,30 @@ Moreover, the following platforms are not supported due to how secretive their o The recommended way to integrate Tracy into an application is to create a git submodule in the repository (assuming that git is used for version control). This way it is very easy to update Tracy to newly released versions. If that's not an option, copy all files from the Tracy checkout directory to your project. +\subsection{Using Tracy via CMake FetchContent} + +When using CMake 3.11 or newer, you can use Tracy via CMake FetchContent. In this case, you do not need git submodule for Tracy. + +Add this to your CMakeLists.txt: + +\begin{lstlisting} + FetchContent_Declare( + tracy + GIT_REPOSITORY https://github.com/wolfpld/tracy.git + GIT_TAG master + GIT_SHALLOW TRUE + GIT_PROGRESS TRUE + ) + + FetchContent_MakeAvailable(tracy) +\end{lstlisting} + +Add this to any target where you use tracy for profiling: + +\begin{lstlisting} + target_link_libraries(${_target} PUBLIC TracyClient) +\end{lstlisting} + \begin{bclogo}[ noborder=true, couleur=black!5,