diff options
author | Sehong Na <sehong.na@samsung.com> | 2014-05-31 12:34:34 +0900 |
---|---|---|
committer | Sehong Na <sehong.na@samsung.com> | 2014-05-31 12:34:34 +0900 |
commit | cc1a12d36421addf6726f86a5b24f913024d8b3a (patch) | |
tree | 253958b9b8d3ffe9120c78cf3bd5389b8e4a0ea0 /Tests/CommandLineTest | |
download | cmake-cc1a12d36421addf6726f86a5b24f913024d8b3a.tar.gz cmake-cc1a12d36421addf6726f86a5b24f913024d8b3a.tar.bz2 cmake-cc1a12d36421addf6726f86a5b24f913024d8b3a.zip |
Initialize Tizen 2.3tizen_2.3_releasesubmit/tizen_2.3/20150202.102300submit/tizen_2.3/20140531.0637312.3a_releasetizen_2.3
Diffstat (limited to 'Tests/CommandLineTest')
-rw-r--r-- | Tests/CommandLineTest/CMakeLists.txt | 79 | ||||
-rw-r--r-- | Tests/CommandLineTest/CommandLineTest.cxx | 4 | ||||
-rw-r--r-- | Tests/CommandLineTest/PreLoad.cmake | 1 |
3 files changed, 84 insertions, 0 deletions
diff --git a/Tests/CommandLineTest/CMakeLists.txt b/Tests/CommandLineTest/CMakeLists.txt new file mode 100644 index 0000000..0493a0c --- /dev/null +++ b/Tests/CommandLineTest/CMakeLists.txt @@ -0,0 +1,79 @@ +cmake_minimum_required (VERSION 2.6) +PROJECT(CommandLineTest) + +GET_FILENAME_COMPONENT(CMAKE_BIN_DIR ${CMAKE_COMMAND} PATH) +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) + +EXEC_CMAKE_COMMAND("-E chdir \"${CMAKE_CURRENT_SOURCE_DIR}\" \"${CMAKE_COMMAND}\" -E echo \"Hello World\"") +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\"") + +ADD_EXECUTABLE(CommandLineTest CommandLineTest.cxx) + +GET_FILENAME_COMPONENT(CMAKE_COMMAND_PATH "${CMAKE_COMMAND}" PATH) +SET(CTEST_COMMAND "${CMAKE_COMMAND_PATH}/ctest") +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) + +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") + +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) + +IF(DEFINED ENV{TEST_ENVIRONMENT_VARIABLE_NOTSET}) + MESSAGE(SEND_ERROR "Environment variable definition test broken!") +ENDIF(DEFINED ENV{TEST_ENVIRONMENT_VARIABLE_NOTSET}) + +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}") + IF(NOT DEFINED ENV{TEST_ENVIRONMENT_VARIABLE}) + MESSAGE(SEND_ERROR "Environment variable definition test failed!") + ENDIF(NOT DEFINED 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") diff --git a/Tests/CommandLineTest/CommandLineTest.cxx b/Tests/CommandLineTest/CommandLineTest.cxx new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/CommandLineTest/CommandLineTest.cxx @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Tests/CommandLineTest/PreLoad.cmake b/Tests/CommandLineTest/PreLoad.cmake new file mode 100644 index 0000000..87284af --- /dev/null +++ b/Tests/CommandLineTest/PreLoad.cmake @@ -0,0 +1 @@ +SET(THIS_SHOULD_BE_SET ON CACHE BOOL "Some variable") |