| 1 |
# Locate CppUnit. |
| 2 |
# |
| 3 |
# This module defines |
| 4 |
# CPPUNIT_FOUND |
| 5 |
# CPPUNIT_LIBRARIES |
| 6 |
# CPPUNIT_INCLUDE_DIR |
| 7 |
# |
| 8 |
# And defines the imported target CppUnitLib |
| 9 |
|
| 10 |
# Find CppUnit. |
| 11 |
if (NOT CPPUNIT_LIBRARIES AND NOT CPPUNIT_INCLUDE_DIR) |
| 12 |
# Find the headers. |
| 13 |
find_path(CPPUNIT_INCLUDE_DIR |
| 14 |
NAMES |
| 15 |
cppunit/Test.h |
| 16 |
PATHS |
| 17 |
/usr/include |
| 18 |
/usr/local/include |
| 19 |
/opt/include |
| 20 |
/opt/local/include |
| 21 |
/sw/include |
| 22 |
) |
| 23 |
|
| 24 |
# Find the library. |
| 25 |
find_library(CPPUNIT_LIBRARIES |
| 26 |
NAMES |
| 27 |
cppunit |
| 28 |
PATHS |
| 29 |
/usr/lib |
| 30 |
/usr/local/lib |
| 31 |
/opt/lib |
| 32 |
/opt/local/lib |
| 33 |
/sw/lib |
| 34 |
) |
| 35 |
|
| 36 |
endif () |
| 37 |
|
| 38 |
|
| 39 |
# Pre-set or found. |
| 40 |
if (CPPUNIT_LIBRARIES AND CPPUNIT_INCLUDE_DIR) |
| 41 |
set(CPPUNIT_FOUND TRUE) |
| 42 |
message(STATUS "CppUnit library found: ${CPPUNIT_LIBRARIES}") |
| 43 |
message(STATUS "CppUnit include directory found: ${CPPUNIT_INCLUDE_DIR}") |
| 44 |
|
| 45 |
if(NOT TARGET CppUnitLib) |
| 46 |
add_library(CppUnitLib UNKNOWN IMPORTED) |
| 47 |
set_target_properties(CppUnitLib PROPERTIES |
| 48 |
INTERFACE_INCLUDE_DIRECTORIES "${CPPUNIT_INCLUDE_DIR}" |
| 49 |
IMPORTED_LOCATION "${CPPUNIT_LIBRARIES}") |
| 50 |
endif() |
| 51 |
endif () |
| 52 |
|