gate features behind check

This commit is contained in:
ThePhD 2017-12-23 21:29:29 -05:00
parent 5d44f2e3a9
commit 9a009e5cf1
3 changed files with 8 additions and 5 deletions

View File

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

View File

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

View File

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