-
Notifications
You must be signed in to change notification settings - Fork 0
Adding into a CMake Project
Aaron C. Meadows edited this page Jun 18, 2017
·
2 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})
Now you should be able to build and test!