Skip to content

Adding into a CMake Project

Patrick Mulder edited this page Aug 26, 2019 · 3 revisions

If you've built and installed UnitTest++ from source you simply need to add a find_package() to your CMakeLists.txt:

find_package(UnitTest++ REQUIRED)

find_package() will locate the UnitTest++Config.cmake and execute it, then define some variables:

UnitTest++_CONFIG=/usr/local/lib/cmake/UnitTest++/UnitTest++Config.cmake
UnitTest++_CONSIDERED_CONFIGS=/usr/local/lib/cmake/UnitTest++/UnitTest++Config.cmake
UnitTest++_CONSIDERED_VERSIONS=unknown
UnitTest++_DIR=/usr/local/lib/cmake/UnitTest++
UnitTest++_FOUND=1
UnitTest++_VERSION_COUNT=0
UnitTest++_VERSION_MAJOR=0
UnitTest++_VERSION_MINOR=0
UnitTest++_VERSION_PATCH=0
UnitTest++_VERSION_TWEAK=0

You can use UnitTest++_FOUND to perform special handling in your CMakeLists.txt if UnitTest++ wasn't located.

UnitTest++'s UnitTest++Config.cmake defines the UTPP_INCLUDE_DIRS helper variable for you:

UTPP_INCLUDE_DIRS=/usr/local/include

You should use this variable to add the include path for your unit test executables:

include_directories(${UTPP_INCLUDE_DIRS})

Also, to have the linker resolve the library symbols you should add:

target_link_libraries(foo UnitTest++)

Now you should be able to build and test!

Clone this wiki locally
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy