#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2009,2010,2011,2012,2013, by the GROMACS development team, led by
+# Copyright (c) 2009,2010,2011,2012,2013,2014, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
add_definitions(-DNDEBUG -DBOOST_DISABLE_ASSERTS -DGMX_DISABLE_ASSERTS)
endif ()
+if (BUILD_TESTING)
+ # "tests" target builds all the separate test binaries.
+ add_custom_target(tests)
+ # "run-ctest" is an internal target that actually runs the tests.
+ # This is necessary to be able to add separate targets that execute as part
+ # of 'make check', but are ensured to be executed after the actual tests.
+ add_custom_target(run-ctest
+ COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure
+ COMMENT "Running all tests"
+ VERBATIM)
+ add_dependencies(run-ctest tests)
+ # "check" target builds and runs all tests.
+ add_custom_target(check DEPENDS run-ctest)
+endif()
+
if (NOT GMX_BUILD_MDRUN_ONLY)
add_subdirectory(doxygen)
add_subdirectory(share)
endif ()
add_subdirectory(src)
+if (BUILD_TESTING)
+ add_subdirectory(tests)
+endif()
+
# Issue a warning if NVIDIA GPUs were detected, but CUDA was not found.
# Don't bother the user after the first configure pass.
if ((CUDA_NOTFOUND_AUTO AND GMX_DETECT_GPU_AVAILABLE) AND NOT GMX_GPU_DETECTION_DONE)
"${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake")
###########################
-########################################################################
-# Tests #
-########################################################################
-
-IF(BUILD_TESTING)
- enable_testing()
- #"check" target builds and runs all tests
- add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure)
- add_dependencies(check tests)
- # TODO: This would be better within tests/CMakeLists.txt
- if (NOT GMX_BUILD_MDRUN_ONLY)
- #gmxtests target builds all binaries required for running gmxtest
- add_custom_target(gmxtests DEPENDS gmx links)
- add_dependencies(check gmxtests)
- add_subdirectory(tests)
- endif()
- #TODO: Add warning if NOT REGRESSIONTEST_PATH OR NOT GMX_XML that regression/unit tests are not run.
-ENDIF()
-
########################################################################
# Manual #
########################################################################
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2009,2010,2011,2012,2013, by the GROMACS development team, led by
+# Copyright (c) 2009,2010,2011,2012,2013,2014, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
configure_file(buildinfo.h.cmakein buildinfo.h ESCAPE_QUOTES)
if (BUILD_TESTING)
- add_custom_target(tests)
if (GMX_BUILD_UNITTESTS)
add_subdirectory(external/gmock-1.7.0)
- endif (GMX_BUILD_UNITTESTS)
+ endif()
include(testutils/TestMacros.cmake)
if (GMX_BUILD_UNITTESTS)
add_subdirectory(testutils)
- endif (GMX_BUILD_UNITTESTS)
-endif (BUILD_TESTING)
+ else()
+ add_custom_target(unittests-notice
+ ${CMAKE_COMMAND} -E echo "NOTE: Unit tests have not been run. You need to set GMX_BUILD_UNITTESTS=ON if you want to build and run them."
+ DEPENDS run-ctest
+ COMMENT "Unit tests disabled" VERBATIM)
+ add_dependencies(check unittests-notice)
+ endif()
+endif()
add_subdirectory(gromacs)
add_subdirectory(programs)
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
set(REGRESSIONTEST_PATH "" CACHE PATH "Directory containing regressiontests")
mark_as_advanced(REGRESSIONTEST_PATH)
option(REGRESSIONTEST_DOWNLOAD
- "Automatically download regressiontests. Tests can be run with ctest." no)
-if(REGRESSIONTEST_DOWNLOAD AND CMAKE_VERSION VERSION_LESS "2.8.2")
- message(WARNING "REGRESSIONTEST_DOWNLOAD requires cmake >=2.8.2. Please update cmake or manually download the regressiontests.")
- set(REGRESSIONTEST_DOWNLOAD FALSE CACHE BOOL
- "REGRESSIONTEST_DOWNLOAD not supported with cmake ${CMAKE_VERSION}" FORCE)
-endif()
+ "Automatically download regressiontests. Tests can be run with ctest." OFF)
+
if(REGRESSIONTEST_DOWNLOAD)
if("${PROJECT_VERSION}" MATCHES "-dev")
if("${PROJECT_VERSION}" MATCHES "^5[.]")
set(REGRESSIONTEST_DOWNLOAD OFF CACHE BOOL "Tests already downloaded. Set to yes to download again" FORCE)
endif()
-if(REGRESSIONTEST_PATH AND (GMX_BLUEGENE OR CMAKE_CROSSCOMPILING OR CMAKE_CONFIGURATION_TYPES))
- #Bluegene requires us to compile both front-end and back-end binaries (single build is insufficient)
- message(WARNING
- "With cross-compiling or multi-configuration generators (e.g. Visual Studio), running regressiontests from build system is not supported. Please run gmxtest.pl directly.")
- set(REGRESSIONTEST_PATH OFF CACHE BOOL
+if(REGRESSIONTEST_PATH AND (GMX_BLUEGENE OR CMAKE_CROSSCOMPILING OR CMAKE_CONFIGURATION_TYPES OR GMX_BUILD_MDRUN_ONLY))
+ # TODO: It would be nicer to do these before potentially downloading the tests.
+ # Bluegene requires us to compile both front-end and back-end binaries
+ # (single build is insufficient)
+ # Testing an mdrun-only builds require supporting binaries from a full build
+ message(WARNING
+ "With cross-compiling, multi-configuration generators (e.g. Visual Studio), or with mdrun-only builds, running regressiontests from build system is not supported. Please run gmxtest.pl directly.")
+ set(REGRESSIONTEST_PATH OFF CACHE BOOL
"With cross-compiling or multi-configuration generators, running regressiontests from build system is not supported." FORCE)
endif()
message(FATAL_ERROR
"REGRESSIONTEST_PATH invalid. The path needs to contain gmxtest.pl.")
endif()
+
+ # gmxtests target builds all binaries required for running gmxtest
+ add_custom_target(gmxtests DEPENDS gmx)
+ add_dependencies(check gmxtests)
+
if(GMX_DOUBLE)
list(APPEND ARGS -double)
endif()
set_tests_properties(regressiontests/${subtest} PROPERTIES
ENVIRONMENT "PATH=${PATH}")
endforeach()
+else()
+ add_custom_target(regressiontests-notice
+ ${CMAKE_COMMAND} -E echo "NOTE: Regression tests have not been run. If you want to run them from the build system, get the correct version of the regression tests package and set REGRESSIONTEST_PATH in CMake to point to it, or set REGRESSIONTEST_DOWNLOAD=ON."
+ DEPENDS run-ctest
+ COMMENT "Regression tests not available" VERBATIM)
+ add_dependencies(check regressiontests-notice)
endif()
include(CppCheck.cmake)