diff options
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r-- | Tests/RunCMake/try_compile/RunCMakeTest.cmake | 4 | ||||
-rw-r--r-- | Tests/RunCMake/try_compile/TargetTypeExe.cmake | 14 | ||||
-rw-r--r-- | Tests/RunCMake/try_compile/TargetTypeInvalid-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/try_compile/TargetTypeInvalid-stderr.txt | 5 | ||||
-rw-r--r-- | Tests/RunCMake/try_compile/TargetTypeInvalid.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/try_compile/TargetTypeStatic.cmake | 14 | ||||
-rw-r--r-- | Tests/RunCMake/try_compile/other.c | 1 |
7 files changed, 41 insertions, 0 deletions
diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake index 6cdbafa..43ce998 100644 --- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake @@ -16,6 +16,10 @@ run_cmake(BadSources2) run_cmake(NonSourceCopyFile) run_cmake(NonSourceCompileDefinitions) +run_cmake(TargetTypeExe) +run_cmake(TargetTypeInvalid) +run_cmake(TargetTypeStatic) + run_cmake(CMP0056) if(RunCMake_GENERATOR MATCHES "Make|Ninja") diff --git a/Tests/RunCMake/try_compile/TargetTypeExe.cmake b/Tests/RunCMake/try_compile/TargetTypeExe.cmake new file mode 100644 index 0000000..9b6e727 --- /dev/null +++ b/Tests/RunCMake/try_compile/TargetTypeExe.cmake @@ -0,0 +1,14 @@ +enable_language(C) +set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE) +try_compile(result ${CMAKE_CURRENT_BINARY_DIR} + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c + OUTPUT_VARIABLE out + COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/copy + COPY_FILE_ERROR copy_err + ) +if(NOT result) + message(FATAL_ERROR "try_compile failed:\n${out}") +endif() +if(copy_err) + message(FATAL_ERROR "try_compile COPY_FILE failed:\n${copy_err}") +endif() diff --git a/Tests/RunCMake/try_compile/TargetTypeInvalid-result.txt b/Tests/RunCMake/try_compile/TargetTypeInvalid-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/TargetTypeInvalid-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/TargetTypeInvalid-stderr.txt b/Tests/RunCMake/try_compile/TargetTypeInvalid-stderr.txt new file mode 100644 index 0000000..08b281a --- /dev/null +++ b/Tests/RunCMake/try_compile/TargetTypeInvalid-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at TargetTypeInvalid.cmake:2 \(try_compile\): + Invalid value 'INVALID' for CMAKE_TRY_COMPILE_TARGET_TYPE. Only + 'EXECUTABLE' and 'STATIC_LIBRARY' are allowed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/TargetTypeInvalid.cmake b/Tests/RunCMake/try_compile/TargetTypeInvalid.cmake new file mode 100644 index 0000000..0bbc4ac --- /dev/null +++ b/Tests/RunCMake/try_compile/TargetTypeInvalid.cmake @@ -0,0 +1,2 @@ +set(CMAKE_TRY_COMPILE_TARGET_TYPE INVALID) +try_compile(result ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c) diff --git a/Tests/RunCMake/try_compile/TargetTypeStatic.cmake b/Tests/RunCMake/try_compile/TargetTypeStatic.cmake new file mode 100644 index 0000000..006b8b8 --- /dev/null +++ b/Tests/RunCMake/try_compile/TargetTypeStatic.cmake @@ -0,0 +1,14 @@ +enable_language(C) +set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) +try_compile(result ${CMAKE_CURRENT_BINARY_DIR} + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/other.c + OUTPUT_VARIABLE out + COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/copy + COPY_FILE_ERROR copy_err + ) +if(NOT result) + message(FATAL_ERROR "try_compile failed:\n${out}") +endif() +if(copy_err) + message(FATAL_ERROR "try_compile COPY_FILE failed:\n${copy_err}") +endif() diff --git a/Tests/RunCMake/try_compile/other.c b/Tests/RunCMake/try_compile/other.c new file mode 100644 index 0000000..6c24f10 --- /dev/null +++ b/Tests/RunCMake/try_compile/other.c @@ -0,0 +1 @@ +int other(void) { return 0; } |