From 9a009e5cf19b2cf56bec64bc530884bc30b7e556 Mon Sep 17 00:00:00 2001 From: ThePhD Date: Sat, 23 Dec 2017 21:29:29 -0500 Subject: [PATCH] gate features behind check --- CMakeLists.txt | 9 ++++++--- examples/CMakeLists.txt | 2 +- tests/CMakeLists.txt | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f127d850..74f4f313 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -138,21 +138,24 @@ if (PYTHONINTERP_FOUND) DESTINATION include/sol) endif() if (DOCS) + set(SOL2_DOCS_FOUND TRUE) add_custom_command(OUTPUT documentation COMMAND "make html" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs) add_custom_target(docs DEPENDS documentation) install(DIRECTORY "${CMAKE_SOURCE_DIR}/docs/build/html" DESTINATION bin/docs) endif() else() if (SINGLE) + set(SOL2_SINGLE_FOUND FALSE) message(STATUS "single_header cannot be generated as python 3 has not been found.") endif() if (DOCS) + set(SOL2_DOCS_FOUND FALSE) message(STATUS "documentation cannot be generated as python 3 has not been found.") endif() endif() # # # Tests, Examples and other CI suites that come with sol2 -#if (TESTS OR TESTS_SINGLE OR EXAMPLES) +if (TESTS OR TESTS_SINGLE OR EXAMPLES OR TESTS_EXAMPLES) # # # Libraries # Here, we pull in all the necessary libraries for building examples and tests # Find threading library @@ -187,8 +190,8 @@ endif() # # # Examples # # Enable examples to be built against the library - if (EXAMPLES) + if (EXAMPLES OR TESTS_EXAMPLES) # NOTE: will also add to tests if TESTS is defined add_subdirectory(examples "${CMAKE_BINARY_DIR}/examples") endif() -#endif() +endif() diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 5d25bcf5..0628e3ac 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -81,7 +81,7 @@ endfunction(MAKE_EXAMPLE) foreach(example_source_file ${EXAMPLES_SRC}) MAKE_EXAMPLE(${example_source_file} FALSE) - if (TESTS_SINGLE) + if (TESTS_SINGLE AND SOL2_SINGLE_FOUND) MAKE_EXAMPLE(${example_source_file} TRUE) endif() endforeach() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 29384eae..8959ca59 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -70,6 +70,6 @@ function(CREATE_TEST test_target_name test_name is_single) endfunction(CREATE_TEST) CREATE_TEST(tests "tests" FALSE) -if (TESTS_SINGLE) +if (TESTS_SINGLE AND SOL2_SINGLE_FOUND) CREATE_TEST(tests_single "tests.single" TRUE) endif()