From e5ec792907dee2d14f5eac300bc32b978a712370 Mon Sep 17 00:00:00 2001 From: Snaipe Date: Wed, 9 Sep 2015 17:14:45 +0200 Subject: [PATCH] Added find module for criterion --- README.md | 6 ++++++ dev/FindCriterion.cmake | 27 +++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 dev/FindCriterion.cmake diff --git a/README.md b/README.md index 27863f0..a1b0962 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,10 @@ Sample tests can be found in the [sample directory][samples]. Gitter.im chat room: [![Join the chat at https://gitter.im/Snaipe/Criterion](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Snaipe/Criterion?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +### Misc + +* [CMake find module for Criterion][find-module] + ## F.A.Q. **Q. What's wrong with other C test frameworks?** @@ -98,3 +102,5 @@ Logo done by [Greehm](http://www.cargocollective.com/pbouigue) [sample-fixtures]: ./samples/fixtures.c [sample-signal]: ./samples/signal.c [sample-report]: ./samples/report.c + +[find-module]: ./dev/FindCriterion.cmake diff --git a/dev/FindCriterion.cmake b/dev/FindCriterion.cmake new file mode 100644 index 0000000..1ca96d9 --- /dev/null +++ b/dev/FindCriterion.cmake @@ -0,0 +1,27 @@ +# This file is licensed under the WTFPL version 2 -- you can see the full +# license over at http://www.wtfpl.net/txt/copying/ +# +# - Try to find Criterion +# +# Once done this will define +# CRITERION_FOUND - System has LibXml2 +# CRITERION_INCLUDE_DIRS - The LibXml2 include directories +# CRITERION_LIBRARIES - The libraries needed to use LibXml2 + +find_package(PkgConfig) + +find_path(CRITERION_INCLUDE_DIR criterion/criterion.h + PATH_SUFFIXES criterion) + +find_library(CRITERION_LIBRARY NAMES criterion libcriterion) + +set(CRITERION_LIBRARIES ${CRITERION_LIBRARY}) +set(CRITERION_INCLUDE_DIRS ${CRITERION_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set CRITERION_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(LibXml2 DEFAULT_MSG + CRITERION_LIBRARY CRITERION_INCLUDE_DIR) + +mark_as_advanced(CRITERION_INCLUDE_DIR CRITERION_LIBRARY)