Skip to content
Snippets Groups Projects
Commit 5188461a authored by Sergey Yakubov's avatar Sergey Yakubov
Browse files

Merge pull request #8 in HIDRA2/hidra2 from cmakefiles to develop

* commit 'c796c093':
  update cmake files
parents 6d7c77d9 c796c093
No related branches found
No related tags found
No related merge requests found
find_program(ASTYLE_EXECUTABLE astyle)
add_custom_target(ASTYLE)
if(ASTYLE_EXECUTABLE)
message(STATUS "Found astyle, using astyle to format code of target ${target}.")
add_custom_target(astyle ALL
COMMAND
${ASTYLE_EXECUTABLE} -i
--exclude=${PROJECT_BINARY_DIR}
--recursive -n --style=google
--recursive -n --style=google --indent=spaces=4
--max-instatement-indent=120
"${PROJECT_SOURCE_DIR}/*.cpp" "${PROJECT_SOURCE_DIR}/*.h"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
VERBATIM
......
if(BUILD_TESTS)
enable_testing()
set (HIDRA2_MINIMUM_COVERAGE 70)
find_package (Threads)
endif()
if (BUILD_TESTS)
enable_testing()
set(HIDRA2_MINIMUM_COVERAGE 70)
find_package(Threads)
endif ()
function(gtest target test_source_files test_libraries)
if(BUILD_TESTS)
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
add_executable(test-${target} ${test_source_files})
target_link_libraries(test-${target} gtest gtest_main ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(test-${target} ${test_libraries})
add_test(NAME test-${target} COMMAND test-${target})
message(STATUS "Added test 'test-${target}'")
if(CMAKE_COMPILER_IS_GNUCXX)
include(CodeCoverage)
APPEND_COVERAGE_COMPILER_FLAGS()
set (COVERAGE_EXCLUDES 'unittests/*')
SETUP_TARGET_FOR_COVERAGE(NAME coverage-${target} EXECUTABLE test-${target} ${target})
add_test(NAME coveragetest-${target}
COMMAND ${CMAKE_MODULE_PATH}/check_test.sh
coverage-${target} ${CMAKE_BINARY_DIR} ${HIDRA2_MINIMUM_COVERAGE}
)
SET_TESTS_PROPERTIES(coveragetest-${target} PROPERTIES DEPENDS test-${target})
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} PARENT_SCOPE)
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} PARENT_SCOPE)
endif()
endif()
if (BUILD_TESTS)
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
add_executable(test-${target} ${test_source_files})
target_link_libraries(test-${target} gtest gtest_main ${CMAKE_THREAD_LIBS_INIT})
if (NOT ${test_libraries} STREQUAL "")
target_link_libraries(test-${target} ${test_libraries})
endif ()
add_test(NAME test-${target} COMMAND test-${target})
set_tests_properties(test-${target} PROPERTIES LABELS "unit;all")
message(STATUS "Added test 'test-${target}'")
if (CMAKE_COMPILER_IS_GNUCXX)
include(CodeCoverage)
APPEND_COVERAGE_COMPILER_FLAGS()
set (COVERAGE_EXCLUDES '*/unittests/*')
SETUP_TARGET_FOR_COVERAGE(NAME coverage-${target} EXECUTABLE test-${target} ${target})
add_test(NAME coveragetest-${target}
COMMAND ${CMAKE_MODULE_PATH}/check_test.sh
coverage-${target} ${CMAKE_BINARY_DIR} ${HIDRA2_MINIMUM_COVERAGE})
set_tests_properties(coveragetest-${target} PROPERTIES LABELS "coverage;all")
SET_TESTS_PROPERTIES(coveragetest-${target} PROPERTIES DEPENDS test-${target})
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} PARENT_SCOPE)
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} PARENT_SCOPE)
endif ()
endif ()
endfunction()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment