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) DESTINATION include/sol)
endif() endif()
if (DOCS) if (DOCS)
set(SOL2_DOCS_FOUND TRUE)
add_custom_command(OUTPUT documentation COMMAND "make html" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs) add_custom_command(OUTPUT documentation COMMAND "make html" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs)
add_custom_target(docs DEPENDS documentation) add_custom_target(docs DEPENDS documentation)
install(DIRECTORY "${CMAKE_SOURCE_DIR}/docs/build/html" DESTINATION bin/docs) install(DIRECTORY "${CMAKE_SOURCE_DIR}/docs/build/html" DESTINATION bin/docs)
endif() endif()
else() else()
if (SINGLE) if (SINGLE)
set(SOL2_SINGLE_FOUND FALSE)
message(STATUS "single_header cannot be generated as python 3 has not been found.") message(STATUS "single_header cannot be generated as python 3 has not been found.")
endif() endif()
if (DOCS) if (DOCS)
set(SOL2_DOCS_FOUND FALSE)
message(STATUS "documentation cannot be generated as python 3 has not been found.") message(STATUS "documentation cannot be generated as python 3 has not been found.")
endif() endif()
endif() endif()
# # # Tests, Examples and other CI suites that come with sol2 # # # 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 # # # Libraries
# Here, we pull in all the necessary libraries for building examples and tests # Here, we pull in all the necessary libraries for building examples and tests
# Find threading library # Find threading library
@ -187,8 +190,8 @@ endif()
# # # Examples # # # Examples
# # Enable examples to be built against the library # # 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 # NOTE: will also add to tests if TESTS is defined
add_subdirectory(examples "${CMAKE_BINARY_DIR}/examples") add_subdirectory(examples "${CMAKE_BINARY_DIR}/examples")
endif() endif()
#endif() endif()

View File

@ -81,7 +81,7 @@ endfunction(MAKE_EXAMPLE)
foreach(example_source_file ${EXAMPLES_SRC}) foreach(example_source_file ${EXAMPLES_SRC})
MAKE_EXAMPLE(${example_source_file} FALSE) MAKE_EXAMPLE(${example_source_file} FALSE)
if (TESTS_SINGLE) if (TESTS_SINGLE AND SOL2_SINGLE_FOUND)
MAKE_EXAMPLE(${example_source_file} TRUE) MAKE_EXAMPLE(${example_source_file} TRUE)
endif() endif()
endforeach() endforeach()

View File

@ -70,6 +70,6 @@ function(CREATE_TEST test_target_name test_name is_single)
endfunction(CREATE_TEST) endfunction(CREATE_TEST)
CREATE_TEST(tests "tests" FALSE) CREATE_TEST(tests "tests" FALSE)
if (TESTS_SINGLE) if (TESTS_SINGLE AND SOL2_SINGLE_FOUND)
CREATE_TEST(tests_single "tests.single" TRUE) CREATE_TEST(tests_single "tests.single" TRUE)
endif() endif()