Add notes about CPack + CTest + Policies

This commit is contained in:
Matteo Settenvini 2019-07-28 21:53:30 +02:00
parent 0a5348b401
commit 9d55c4e3dd
2 changed files with 71 additions and 6 deletions

View File

@ -1,3 +1,46 @@
\subsection{Miscellaneus}
\begin{frame}
\frametitle{Other provided tools}
\begin{itemize}
\item \textbf{CPack}: package your files
directly in packages native to the target
platform, and have fine grained control
over components.
\vspace{1em}
\item \textbf{CTest}: have a common
frontend to run tests which might have different
test runners. Allow running in parallel.
Limited to tests in the build folder (not
installed).
\end{itemize}
\end{frame}
% --------------------------------------------------
\begin{frame}[containsverbatim]
\frametitle{Policies}
\begin{itemize}
\item Policies to apply are chosen through the
{\code cmake\_minimum\_required(VERSION ...)}
construct.
\vspace{1em}
\item CMake strives hard to provide backwards
compatibility with the version you specify.
\vspace{1em}
\item Changes in behavior from higher CMake
versions will not be applied.
\end{itemize}
\end{frame}
% --------------------------------------------------
\subsection{Q\&A}

View File

@ -87,7 +87,7 @@
\vspace{1em}
Each target corresponds to an executable or library, or is a custom
Each target either corresponds to an executable or library, or is a custom
target containing custom commands.
\vspace{1em}
@ -97,10 +97,32 @@ add_library(archive archive.cpp zip.cpp lzma.cpp)
add_executable(zipapp zipapp.cpp)
target_link_libraries(zipapp archive)
\end{codebox}
\end{frame}
% --------------------------------------------------------------------
\begin{frame}[containsverbatim]
\frametitle{Custom Target and Dependencies}
Example with custom targets:
\vspace{1em}
\begin{codebox}{CMake}{}
add_custom_command(OUTPUT output.file
COMMAND generator
--in ${CMAKE_CURRENT_SOURCE_DIR}/input.file
--out output.file
DEPENDS input.file
COMMENT "This is an example invocation of a generator"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
add_custom_target(my-target
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/output.file)
\end{codebox}
\end{frame}
\begin{frame}[containsverbatim]
\frametitle{Transitive Usage Requirements}