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()