2003-07-24 18:58:40 +04:00
|
|
|
PROJECT(CommandLineTest)
|
|
|
|
|
|
|
|
GET_FILENAME_COMPONENT(CMAKE_BIN_DIR ${CMAKE_COMMAND} PATH)
|
|
|
|
FIND_PROGRAM(DUMP_DOC_EXE NAMES DumpDocumentation PATHS ${CMAKE_BIN_DIR})
|
2005-02-16 21:15:25 +03:00
|
|
|
MACRO(EXEC_CMAKE_COMMAND CMAKE_ARGS)
|
|
|
|
EXEC_PROGRAM("${CMAKE_COMMAND}" ARGS "${CMAKE_ARGS}" RETURN_VALUE RET)
|
|
|
|
IF(${RET})
|
|
|
|
MESSAGE(SEND_ERROR "CMake command failed with arguments \"${CMAKE_ARGS}\"")
|
|
|
|
ENDIF(${RET})
|
|
|
|
ENDMACRO(EXEC_CMAKE_COMMAND)
|
2003-07-24 18:58:40 +04:00
|
|
|
|
2005-02-17 15:53:03 +03:00
|
|
|
EXEC_CMAKE_COMMAND("-E chdir \"${CMAKE_CURRENT_SOURCE_DIR}\" \"${CMAKE_COMMAND}\" -E echo \"Hello World\"")
|
2005-02-16 21:15:25 +03:00
|
|
|
EXEC_CMAKE_COMMAND("-E time \"${CMAKE_COMMAND} -N -L ${CommandLineTest_SOURCE_DIR}\"")
|
|
|
|
EXEC_CMAKE_COMMAND("-E time \"${CMAKE_COMMAND} -N -LA ${CommandLineTest_SOURCE_DIR}\"")
|
|
|
|
EXEC_CMAKE_COMMAND("-E time \"${CMAKE_COMMAND} -N -LH ${CommandLineTest_SOURCE_DIR}\"")
|
|
|
|
EXEC_CMAKE_COMMAND("-E time \"${CMAKE_COMMAND} -N -LAH ${CommandLineTest_SOURCE_DIR}\"")
|
|
|
|
EXEC_CMAKE_COMMAND("--help")
|
|
|
|
EXEC_CMAKE_COMMAND("--help-command-list")
|
|
|
|
EXEC_CMAKE_COMMAND("--help ADD_EXECUTABLE")
|
|
|
|
EXEC_CMAKE_COMMAND("--help-command ADD_EXECUTABLE")
|
|
|
|
EXEC_CMAKE_COMMAND("--help-full \"${CMAKE_CURRENT_BINARY_DIR}/cmake.txt\"")
|
|
|
|
EXEC_CMAKE_COMMAND("--help-man \"${CMAKE_CURRENT_BINARY_DIR}/cmake.man\"")
|
|
|
|
EXEC_CMAKE_COMMAND("--help-html \"${CMAKE_CURRENT_BINARY_DIR}/cmake.html\"")
|
|
|
|
EXEC_CMAKE_COMMAND("--copyright \"${CMAKE_CURRENT_BINARY_DIR}/Copyright.txt\"")
|
|
|
|
EXEC_CMAKE_COMMAND("--version \"${CMAKE_CURRENT_BINARY_DIR}/version.txt\"")
|
2003-07-24 18:58:40 +04:00
|
|
|
|
|
|
|
IF(DUMP_DOC_EXE)
|
2005-02-16 21:15:25 +03:00
|
|
|
EXEC_PROGRAM(${DUMP_DOC_EXE} ARGS "--all-for-coverage \"${CMAKE_CURRENT_BINARY_DIR}/all_for_coverage.txt\"" RETURN_VALUE RET)
|
|
|
|
IF(${RET})
|
|
|
|
MESSAGE(SEND_ERROR "DumpDoc command failed ")
|
|
|
|
ENDIF(${RET})
|
2003-07-24 18:58:40 +04:00
|
|
|
ELSE(DUMP_DOC_EXE)
|
|
|
|
MESSAGE(SEND_ERROR "Cannot find DumpDocumentation executable.")
|
|
|
|
ENDIF(DUMP_DOC_EXE)
|
|
|
|
|
|
|
|
ADD_EXECUTABLE(CommandLineTest CommandLineTest.cxx)
|
2004-04-28 18:52:20 +04:00
|
|
|
|
2004-05-11 02:06:11 +04:00
|
|
|
GET_FILENAME_COMPONENT(CMAKE_COMMAND_PATH "${CMAKE_COMMAND}" PATH)
|
|
|
|
SET(CTEST_COMMAND "${CMAKE_COMMAND_PATH}/ctest")
|
2005-02-16 21:15:25 +03:00
|
|
|
MACRO(EXEC_CTEST_COMMAND CMAKE_ARGS)
|
|
|
|
EXEC_PROGRAM("${CTEST_COMMAND}" ARGS "${CMAKE_ARGS}" RETURN_VALUE RET)
|
|
|
|
IF(${RET})
|
|
|
|
MESSAGE(SEND_ERROR "CTest command failed with arguments \"${CMAKE_ARGS}\"")
|
|
|
|
ENDIF(${RET})
|
|
|
|
ENDMACRO(EXEC_CTEST_COMMAND)
|
|
|
|
MACRO(EXEC_CTEST_COMMAND_WITH_DIR DIR CMAKE_ARGS)
|
|
|
|
EXEC_PROGRAM("${CTEST_COMMAND}" "${DIR}" ARGS "${CMAKE_ARGS}" RETURN_VALUE RET)
|
|
|
|
IF(${RET})
|
|
|
|
MESSAGE(SEND_ERROR "CTest command failed with arguments \"${CMAKE_ARGS}\"")
|
|
|
|
ENDIF(${RET})
|
|
|
|
ENDMACRO(EXEC_CTEST_COMMAND_WITH_DIR)
|
2004-05-11 02:06:11 +04:00
|
|
|
|
2005-02-16 21:15:25 +03:00
|
|
|
EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." "-N")
|
|
|
|
EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." "-R complex -N")
|
|
|
|
EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." "-E Simple -N")
|
|
|
|
EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." "-E Simple -N")
|
|
|
|
EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." "-N -I -10")
|
|
|
|
EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." "-N -I 10-")
|
|
|
|
EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." "-N -I 3,4")
|
|
|
|
EXEC_CTEST_COMMAND("--help")
|
|
|
|
EXEC_CTEST_COMMAND("--copyright")
|
|
|
|
EXEC_CTEST_COMMAND("--help-full \"${CMAKE_CURRENT_BINARY_DIR}/ctest.txt\"")
|
|
|
|
EXEC_CTEST_COMMAND("--help-man \"${CMAKE_CURRENT_BINARY_DIR}/ctest.man\"")
|
|
|
|
EXEC_CTEST_COMMAND("--help-html \"${CMAKE_CURRENT_BINARY_DIR}/ctest.html\"")
|
|
|
|
EXEC_CTEST_COMMAND("--version")
|
2004-05-11 02:06:11 +04:00
|
|
|
|
2004-04-28 18:52:20 +04:00
|
|
|
IF(THIS_SHOULD_BE_SET)
|
|
|
|
MESSAGE(STATUS "***************************")
|
|
|
|
MESSAGE(STATUS "PreLoad.cmake works fine.")
|
|
|
|
MESSAGE(STATUS "***************************")
|
|
|
|
ELSE(THIS_SHOULD_BE_SET)
|
|
|
|
MESSAGE("***************************")
|
|
|
|
MESSAGE(FATAL_ERROR "PreLoad.cmake does not work.")
|
|
|
|
ENDIF(THIS_SHOULD_BE_SET)
|
2005-06-03 22:42:05 +04:00
|
|
|
|
|
|
|
SET(ENV{TEST_ENVIRONMENT_VARIABLE} "Environment variable set")
|
|
|
|
IF("$ENV{TEST_ENVIRONMENT_VARIABLE}" STREQUAL "Environment variable set")
|
|
|
|
MESSAGE(STATUS "Environment variable set to: $ENV{TEST_ENVIRONMENT_VARIABLE}")
|
|
|
|
ELSE("$ENV{TEST_ENVIRONMENT_VARIABLE}" STREQUAL "Environment variable set")
|
|
|
|
MESSAGE(SEND_ERROR "Environment variable setting is broken")
|
|
|
|
ENDIF("$ENV{TEST_ENVIRONMENT_VARIABLE}" STREQUAL "Environment variable set")
|