ソースを参照

try_compile: Add test for bad call error cases

Add a RunCMake.try_compile test to cover cases of bad invocation of the
try_compile command.
Brad King 12 年 前
コミット
b680824a5f
32 ファイル変更80 行追加0 行削除
  1. 1 0
      Tests/RunCMake/CMakeLists.txt
  2. 1 0
      Tests/RunCMake/try_compile/BadLinkLibraries-result.txt
  3. 5 0
      Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt
  4. 3 0
      Tests/RunCMake/try_compile/BadLinkLibraries.cmake
  5. 3 0
      Tests/RunCMake/try_compile/CMakeLists.txt
  6. 1 0
      Tests/RunCMake/try_compile/NoArgs-result.txt
  7. 4 0
      Tests/RunCMake/try_compile/NoArgs-stderr.txt
  8. 1 0
      Tests/RunCMake/try_compile/NoArgs.cmake
  9. 1 0
      Tests/RunCMake/try_compile/NoCopyFile-result.txt
  10. 4 0
      Tests/RunCMake/try_compile/NoCopyFile-stderr.txt
  11. 2 0
      Tests/RunCMake/try_compile/NoCopyFile.cmake
  12. 1 0
      Tests/RunCMake/try_compile/NoLinkLibraries-result.txt
  13. 4 0
      Tests/RunCMake/try_compile/NoLinkLibraries-stderr.txt
  14. 2 0
      Tests/RunCMake/try_compile/NoLinkLibraries.cmake
  15. 1 0
      Tests/RunCMake/try_compile/NoOutputVariable-result.txt
  16. 4 0
      Tests/RunCMake/try_compile/NoOutputVariable-stderr.txt
  17. 2 0
      Tests/RunCMake/try_compile/NoOutputVariable.cmake
  18. 1 0
      Tests/RunCMake/try_compile/NonSourceCompileDefinitions-result.txt
  19. 4 0
      Tests/RunCMake/try_compile/NonSourceCompileDefinitions-stderr.txt
  20. 2 0
      Tests/RunCMake/try_compile/NonSourceCompileDefinitions.cmake
  21. 1 0
      Tests/RunCMake/try_compile/NonSourceCopyFile-result.txt
  22. 4 0
      Tests/RunCMake/try_compile/NonSourceCopyFile-stderr.txt
  23. 2 0
      Tests/RunCMake/try_compile/NonSourceCopyFile.cmake
  24. 1 0
      Tests/RunCMake/try_compile/OneArg-result.txt
  25. 4 0
      Tests/RunCMake/try_compile/OneArg-stderr.txt
  26. 1 0
      Tests/RunCMake/try_compile/OneArg.cmake
  27. 11 0
      Tests/RunCMake/try_compile/RunCMakeTest.cmake
  28. 1 0
      Tests/RunCMake/try_compile/TwoArgs-result.txt
  29. 4 0
      Tests/RunCMake/try_compile/TwoArgs-stderr.txt
  30. 1 0
      Tests/RunCMake/try_compile/TwoArgs.cmake
  31. 2 0
      Tests/RunCMake/try_compile/proj/CMakeLists.txt
  32. 1 0
      Tests/RunCMake/try_compile/src.c

+ 1 - 0
Tests/RunCMake/CMakeLists.txt

@@ -76,6 +76,7 @@ add_RunCMake_test(if)
 add_RunCMake_test(include)
 add_RunCMake_test(include_directories)
 add_RunCMake_test(list)
+add_RunCMake_test(try_compile)
 add_RunCMake_test(CMP0004)
 
 find_package(Qt4 QUIET)

+ 1 - 0
Tests/RunCMake/try_compile/BadLinkLibraries-result.txt

@@ -0,0 +1 @@
+1

+ 5 - 0
Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt

@@ -0,0 +1,5 @@
+CMake Error at BadLinkLibraries.cmake:2 \(try_compile\):
+  Only libraries may be used as try_compile IMPORTED LINK_LIBRARIES.  Got
+  not_a_library of type UTILITY.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)

+ 3 - 0
Tests/RunCMake/try_compile/BadLinkLibraries.cmake

@@ -0,0 +1,3 @@
+add_custom_target(not_a_library)
+try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+  LINK_LIBRARIES not_a_library)

+ 3 - 0
Tests/RunCMake/try_compile/CMakeLists.txt

@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)

+ 1 - 0
Tests/RunCMake/try_compile/NoArgs-result.txt

@@ -0,0 +1 @@
+1

+ 4 - 0
Tests/RunCMake/try_compile/NoArgs-stderr.txt

@@ -0,0 +1,4 @@
+CMake Error at NoArgs.cmake:1 \(try_compile\):
+  try_compile unknown error.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)

+ 1 - 0
Tests/RunCMake/try_compile/NoArgs.cmake

@@ -0,0 +1 @@
+try_compile()

+ 1 - 0
Tests/RunCMake/try_compile/NoCopyFile-result.txt

@@ -0,0 +1 @@
+1

+ 4 - 0
Tests/RunCMake/try_compile/NoCopyFile-stderr.txt

@@ -0,0 +1,4 @@
+CMake Error at NoCopyFile.cmake:1 \(try_compile\):
+  COPY_FILE specified but there is no variable
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)

+ 2 - 0
Tests/RunCMake/try_compile/NoCopyFile.cmake

@@ -0,0 +1,2 @@
+try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+  COPY_FILE)

+ 1 - 0
Tests/RunCMake/try_compile/NoLinkLibraries-result.txt

@@ -0,0 +1 @@
+1

+ 4 - 0
Tests/RunCMake/try_compile/NoLinkLibraries-stderr.txt

@@ -0,0 +1,4 @@
+CMake Error at NoLinkLibraries.cmake:1 \(try_compile\):
+  LINK_LIBRARIES specified but there is no content
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)

+ 2 - 0
Tests/RunCMake/try_compile/NoLinkLibraries.cmake

@@ -0,0 +1,2 @@
+try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+  LINK_LIBRARIES)

+ 1 - 0
Tests/RunCMake/try_compile/NoOutputVariable-result.txt

@@ -0,0 +1 @@
+1

+ 4 - 0
Tests/RunCMake/try_compile/NoOutputVariable-stderr.txt

@@ -0,0 +1,4 @@
+CMake Error at NoOutputVariable.cmake:1 \(try_compile\):
+  OUTPUT_VARIABLE specified but there is no variable
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)

+ 2 - 0
Tests/RunCMake/try_compile/NoOutputVariable.cmake

@@ -0,0 +1,2 @@
+try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+  OUTPUT_VARIABLE)

+ 1 - 0
Tests/RunCMake/try_compile/NonSourceCompileDefinitions-result.txt

@@ -0,0 +1 @@
+1

+ 4 - 0
Tests/RunCMake/try_compile/NonSourceCompileDefinitions-stderr.txt

@@ -0,0 +1,4 @@
+CMake Error at NonSourceCompileDefinitions.cmake:1 \(try_compile\):
+  COMPILE_FLAGS specified on a srcdir type TRY_COMPILE
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)

+ 2 - 0
Tests/RunCMake/try_compile/NonSourceCompileDefinitions.cmake

@@ -0,0 +1,2 @@
+try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/proj
+  TestProject COMPILE_DEFINITIONS DEF)

+ 1 - 0
Tests/RunCMake/try_compile/NonSourceCopyFile-result.txt

@@ -0,0 +1 @@
+1

+ 4 - 0
Tests/RunCMake/try_compile/NonSourceCopyFile-stderr.txt

@@ -0,0 +1,4 @@
+CMake Error at NonSourceCopyFile.cmake:1 \(try_compile\):
+  COPY_FILE specified on a srcdir type TRY_COMPILE
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)

+ 2 - 0
Tests/RunCMake/try_compile/NonSourceCopyFile.cmake

@@ -0,0 +1,2 @@
+try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/proj
+  TestProject COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/result)

+ 1 - 0
Tests/RunCMake/try_compile/OneArg-result.txt

@@ -0,0 +1 @@
+1

+ 4 - 0
Tests/RunCMake/try_compile/OneArg-stderr.txt

@@ -0,0 +1,4 @@
+CMake Error at OneArg.cmake:1 \(try_compile\):
+  try_compile unknown error.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)

+ 1 - 0
Tests/RunCMake/try_compile/OneArg.cmake

@@ -0,0 +1 @@
+try_compile(RESULT)

+ 11 - 0
Tests/RunCMake/try_compile/RunCMakeTest.cmake

@@ -0,0 +1,11 @@
+include(RunCMake)
+
+run_cmake(NoArgs)
+run_cmake(OneArg)
+run_cmake(TwoArgs)
+run_cmake(NoCopyFile)
+run_cmake(NoOutputVariable)
+run_cmake(NoLinkLibraries)
+run_cmake(BadLinkLibraries)
+run_cmake(NonSourceCopyFile)
+run_cmake(NonSourceCompileDefinitions)

+ 1 - 0
Tests/RunCMake/try_compile/TwoArgs-result.txt

@@ -0,0 +1 @@
+1

+ 4 - 0
Tests/RunCMake/try_compile/TwoArgs-stderr.txt

@@ -0,0 +1,4 @@
+CMake Error at TwoArgs.cmake:1 \(try_compile\):
+  try_compile unknown error.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)

+ 1 - 0
Tests/RunCMake/try_compile/TwoArgs.cmake

@@ -0,0 +1 @@
+try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR})

+ 2 - 0
Tests/RunCMake/try_compile/proj/CMakeLists.txt

@@ -0,0 +1,2 @@
+cmake_minimum_required(VERSION 2.8.10)
+project(TestProject NONE)

+ 1 - 0
Tests/RunCMake/try_compile/src.c

@@ -0,0 +1 @@
+int main(void) { return 0; }