Fix ctest configuration

This commit is contained in:
Jonathan Müller 2018-09-20 21:02:21 +02:00
commit 73f41aac05
2 changed files with 2 additions and 2 deletions

View file

@ -19,7 +19,7 @@ option(CPPAST_BUILD_EXAMPLE "whether or not to build the examples" OFF)
option(CPPAST_BUILD_TOOL "whether or not to build the tool" OFF)
option(BUILD_TESTING "build test" OFF) # The ctest variable for building tests
if((${CPPAST_BUILD_TEST} OR ${BUILD_TESTING}) OR (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR))
if(${CPPAST_BUILD_TEST} OR (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR))
set(build_test ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # for the self integration test
else()
@ -49,6 +49,7 @@ endif()
add_subdirectory(src)
if(${build_test})
enable_testing()
add_subdirectory(test)
endif()
if(${build_example})

View file

@ -49,7 +49,6 @@ target_compile_definitions(cppast_test PUBLIC CPPAST_INTEGRATION_FILE="${CMAKE_C
CPPAST_COMPILE_COMMANDS="${CMAKE_BINARY_DIR}")
set_target_properties(cppast_test PROPERTIES CXX_STANDARD 11)
enable_testing()
add_test(NAME test COMMAND cppast_test)
if(CPPAST_TEST_GCOV AND (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))