aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt7
-rw-r--r--README.md10
-rw-r--r--effcee/CMakeLists.txt28
-rw-r--r--examples/CMakeLists.txt24
-rw-r--r--third_party/CMakeLists.txt2
5 files changed, 40 insertions, 31 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cbbdb4e..1aefeb4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,11 +2,8 @@ cmake_minimum_required(VERSION 2.8.12)
project(effcee C CXX)
enable_testing()
-option(EFFCEE_SKIP_TESTS "Skip building tests" ${EFFCEE_SKIP_TESTS})
-if(NOT ${EFFCEE_SKIP_TESTS})
- set(EFFCEE_ENABLE_TESTS ON)
-endif()
-if(${EFFCEE_ENABLE_TESTS})
+option(EFFCEE_BUILD_TESTING "Enable testing for Effcee" ON)
+if(${EFFCEE_BUILD_TESTING})
message(STATUS "Configuring Effcee to build tests.")
else()
message(STATUS "Configuring Effcee to avoid building tests.")
diff --git a/README.md b/README.md
index 810ac40..e18bff3 100644
--- a/README.md
+++ b/README.md
@@ -186,7 +186,7 @@ cmake configure line.
### Tests
-Effcee registers two tests with `ctest`:
+By default, Effcee registers two tests with `ctest`:
* `effcee-test`: All library tests, based on Googletest.
* `effcee-example`: Executes the example executable with sample inputs.
@@ -194,6 +194,13 @@ Effcee registers two tests with `ctest`:
Running `ctest` without arguments will run the tests for Effcee as well as for
RE2.
+You can disable Effcee's tests by using `-DEFFCEE_BUILD_TESTING=OFF` at
+configuration time:
+
+```sh
+cmake -GNinja -DEFFCEE_BUILD_TESTING=OFF ...
+```
+
The RE2 tests run much longer, so if you're working on Effcee alone, we
suggest limiting ctest to tests with prefix `effcee`:
@@ -230,6 +237,7 @@ On Windows, the following tools should be installed and available on your path:
- `DISABLE_RTTI`. Disable runtime type information. Default is enabled.
- `DISABLE_EXCEPTIONS`. Disable exceptions. Default is enabled.
- `EFFCEE_ENABLE_SHARED_CRT`. See above.
+- `EFFCEE_BUILD_TESTING`. Should Effcee tests be built? Defaults to `ON`.
- `RE2_BUILD_TESTING`. Should RE2 tests be built? Defaults to `ON`.
## Bug tracking
diff --git a/effcee/CMakeLists.txt b/effcee/CMakeLists.txt
index 236ef6f..149f932 100644
--- a/effcee/CMakeLists.txt
+++ b/effcee/CMakeLists.txt
@@ -17,16 +17,18 @@ install(TARGETS effcee
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
-add_executable(effcee-test
- check_test.cc
- cursor_test.cc
- diagnostic_test.cc
- match_test.cc
- options_test.cc
- result_test.cc)
-effcee_default_compile_options(effcee-test)
-target_include_directories(effcee-test PRIVATE
- ${gmock_SOURCE_DIR}/include
- ${gtest_SOURCE_DIR}/include)
-target_link_libraries(effcee-test PRIVATE effcee gmock gtest_main)
-add_test(NAME effcee-test COMMAND effcee-test)
+if(EFFCEE_BUILD_TESTING)
+ add_executable(effcee-test
+ check_test.cc
+ cursor_test.cc
+ diagnostic_test.cc
+ match_test.cc
+ options_test.cc
+ result_test.cc)
+ effcee_default_compile_options(effcee-test)
+ target_include_directories(effcee-test PRIVATE
+ ${gmock_SOURCE_DIR}/include
+ ${gtest_SOURCE_DIR}/include)
+ target_link_libraries(effcee-test PRIVATE effcee gmock gtest_main)
+ add_test(NAME effcee-test COMMAND effcee-test)
+endif(EFFCEE_BUILD_TESTING)
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index d565361..86f5a0f 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -5,14 +5,16 @@ if(UNIX)
target_link_libraries(effcee-example -pthread)
endif(UNIX)
-add_test(NAME effcee-example
- COMMAND ${PYTHON_EXE}
- effcee-example-driver.py
- ${CMAKE_CURRENT_BINARY_DIR}/effcee-example
- example_data.txt
- "CHECK: Hello"
- "CHECK-SAME: world"
- "CHECK-NEXT: Bees"
- "CHECK-NOT: Sting"
- "CHECK: Honey"
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+if(EFFCEE_BUILD_TESTING)
+ add_test(NAME effcee-example
+ COMMAND ${PYTHON_EXE}
+ effcee-example-driver.py
+ ${CMAKE_CURRENT_BINARY_DIR}/effcee-example
+ example_data.txt
+ "CHECK: Hello"
+ "CHECK-SAME: world"
+ "CHECK-NEXT: Bees"
+ "CHECK-NOT: Sting"
+ "CHECK: Honey"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+endif(EFFCEE_BUILD_TESTING)
diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
index cfb5f78..9046573 100644
--- a/third_party/CMakeLists.txt
+++ b/third_party/CMakeLists.txt
@@ -9,7 +9,7 @@ set(EFFCEE_RE2_DIR "${EFFCEE_THIRD_PARTY_ROOT_DIR}/re2" CACHE STRING
"Location of re2 source")
# Configure third party projects.
-if(${EFFCEE_ENABLE_TESTS})
+if(EFFCEE_BUILD_TESTING)
if (IS_DIRECTORY ${EFFCEE_GOOGLETEST_DIR})
add_subdirectory(${EFFCEE_GOOGLETEST_DIR} googletest)
endif()