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.
This commit is contained in:
parent
5377ac4289
commit
b680824a5f
|
@ -76,6 +76,7 @@ add_RunCMake_test(if)
|
||||||
add_RunCMake_test(include)
|
add_RunCMake_test(include)
|
||||||
add_RunCMake_test(include_directories)
|
add_RunCMake_test(include_directories)
|
||||||
add_RunCMake_test(list)
|
add_RunCMake_test(list)
|
||||||
|
add_RunCMake_test(try_compile)
|
||||||
add_RunCMake_test(CMP0004)
|
add_RunCMake_test(CMP0004)
|
||||||
|
|
||||||
find_package(Qt4 QUIET)
|
find_package(Qt4 QUIET)
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -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\)
|
|
@ -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)
|
|
@ -0,0 +1,3 @@
|
||||||
|
cmake_minimum_required(VERSION 2.8)
|
||||||
|
project(${RunCMake_TEST} NONE)
|
||||||
|
include(${RunCMake_TEST}.cmake)
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -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\)
|
|
@ -0,0 +1 @@
|
||||||
|
try_compile()
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -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\)
|
|
@ -0,0 +1,2 @@
|
||||||
|
try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
|
||||||
|
COPY_FILE)
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -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\)
|
|
@ -0,0 +1,2 @@
|
||||||
|
try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
|
||||||
|
LINK_LIBRARIES)
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -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\)
|
|
@ -0,0 +1,2 @@
|
||||||
|
try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
|
||||||
|
OUTPUT_VARIABLE)
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -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\)
|
|
@ -0,0 +1,2 @@
|
||||||
|
try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/proj
|
||||||
|
TestProject COMPILE_DEFINITIONS DEF)
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -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\)
|
|
@ -0,0 +1,2 @@
|
||||||
|
try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/proj
|
||||||
|
TestProject COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/result)
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -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\)
|
|
@ -0,0 +1 @@
|
||||||
|
try_compile(RESULT)
|
|
@ -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)
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -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\)
|
|
@ -0,0 +1 @@
|
||||||
|
try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR})
|
|
@ -0,0 +1,2 @@
|
||||||
|
cmake_minimum_required(VERSION 2.8.10)
|
||||||
|
project(TestProject NONE)
|
|
@ -0,0 +1 @@
|
||||||
|
int main(void) { return 0; }
|
Loading…
Reference in New Issue