diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a4a4be65..4a6aca4d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,6 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") message(FATAL_ERROR "Do not build in-source.\nPlease remove CMakeCache.txt and the CMakeFiles/ directory.\nThen: mkdir build ; cd build ; cmake .. ; make") endif() -option(CMARK_TESTS "Build cmark tests and enable testing" ON) option(CMARK_STATIC "Build static libcmark library" ON) option(CMARK_SHARED "Build shared libcmark library" ON) option(CMARK_LIB_FUZZER "Build libFuzzer fuzzing harness" OFF) @@ -60,16 +59,18 @@ function(cmark_add_compile_options target) endfunction() add_subdirectory(src) -if(CMARK_TESTS AND (CMARK_SHARED OR CMARK_STATIC)) - add_subdirectory(api_test) +if(BUILD_TESTING) endif() # TODO(compnerd) should this be enabled for MinGW, which sets CMAKE_SYSTEM_NAME # to Windows, but defines `MINGW`. if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows) add_subdirectory(man) endif() -if(CMARK_TESTS) +if(BUILD_TESTING) enable_testing() + if(CMARK_SHARED OR CMARK_STATIC) + add_subdirectory(api_test) + endif() add_subdirectory(test testdir) endif() diff --git a/api_test/CMakeLists.txt b/api_test/CMakeLists.txt index 8f19ff70c..127d96711 100644 --- a/api_test/CMakeLists.txt +++ b/api_test/CMakeLists.txt @@ -10,3 +10,6 @@ if(CMARK_SHARED) else() target_link_libraries(api_test cmark_static) endif() + +add_test(NAME api_test COMMAND api_test) + diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 106d3a9fe..a415a2d26 100755 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -19,10 +19,6 @@ else() IMPORTED_LOCATION ${PYTHON_EXECUTABLE}) endif() -if (CMARK_SHARED OR CMARK_STATIC) - add_test(NAME api_test COMMAND api_test) -endif() - if (WIN32) file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR}/src WIN_DLL_DIR) set(NEWPATH "${WIN_DLL_DIR};$ENV{PATH}") @@ -82,9 +78,7 @@ IF (Python_Interpreter_FOUND) ELSE(Python_Interpreter_FOUND) - message("\n*** A python 3 interpreter is required to run the spec tests.\n") - add_test(skipping_spectests - echo "Skipping spec tests, because no python 3 interpreter is available.") + message(WARNING "A Python 3 Interpreter is required to run the spec tests") ENDIF(Python_Interpreter_FOUND)