#
SET(CTEST_BINARY_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
- IF( "${CTEST_BINARY_DIRECTORY}" STREQUAL "${CTEST_SOURCE_DIRECTORY}")
+ IF( "${CTEST_BINARY_DIRECTORY}" STREQUAL "${CTEST_SOURCE_DIRECTORY}"
+ AND NOT EXISTS ${CTEST_SOURCE_DIRECTORY}/CMakeCache.txt )
MESSAGE(FATAL_ERROR "
-ctest was invoked in the source directory (or test source directory) and CTEST_BINARY_DIRECTORY is not set.
-Please either call ctest from within a designated build directory, or set CTEST_BINARY_DIRECTORY accordingly.
+ctest was invoked in the source directory and CTEST_BINARY_DIRECTORY is not
+set. Please either call ctest from within a designated build directory, or
+set CTEST_BINARY_DIRECTORY accordingly.
"
)
ENDIF()
IF( "${CTEST_BINARY_DIRECTORY}" STREQUAL ""
AND "${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_LIST_DIR}" )
MESSAGE(FATAL_ERROR "
-ctest was invoked in the source directory (or test source directory) and
-CTEST_BINARY_DIRECTORY is not set. Please either call ctest from within a
-designated build directory, or set CTEST_BINARY_DIRECTORY accordingly.
+ctest was invoked in the test directory and CTEST_BINARY_DIRECTORY is not
+set. Please either call ctest from within a designated build directory, or
+set CTEST_BINARY_DIRECTORY accordingly.
"
)
ENDIF()
In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move.
Douglas Adams