Adding into a CMake Project · unittest-cpp/unittest-cpp Wiki · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
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

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.