Add test that CMake errors with empty libs

When the library language cannot be determined, make sure CMake errors,
not segfaults (bug #11230)
This commit is contained in:
Ben Boeckel 2010-09-30 11:01:35 -04:00
parent 4e137de7b1
commit 220c5dc45a
4 changed files with 9 additions and 0 deletions

View File

@ -153,6 +153,9 @@ IF(BUILD_TESTING)
ADD_TEST_MACRO(ExportImport ExportImport) ADD_TEST_MACRO(ExportImport ExportImport)
ADD_TEST_MACRO(Unset Unset) ADD_TEST_MACRO(Unset Unset)
ADD_TEST_MACRO(PolicyScope PolicyScope) ADD_TEST_MACRO(PolicyScope PolicyScope)
ADD_TEST_MACRO(EmptyLibrary EmptyLibrary)
SET_TESTS_PROPERTIES(EmptyLibrary PROPERTIES
PASS_REGULAR_EXPRESSION "CMake Error: Cannot determine link language for target \"test\"")
ADD_TEST_MACRO(CrossCompile CrossCompile) ADD_TEST_MACRO(CrossCompile CrossCompile)
SET_TESTS_PROPERTIES(CrossCompile PROPERTIES SET_TESTS_PROPERTIES(CrossCompile PROPERTIES
PASS_REGULAR_EXPRESSION "TRY_RUN.. invoked in cross-compiling mode") PASS_REGULAR_EXPRESSION "TRY_RUN.. invoked in cross-compiling mode")

View File

@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 2.6)
project(TestEmptyLibrary)
add_subdirectory(subdir)

View File

@ -0,0 +1 @@
add_library(test test.h)

View File

@ -0,0 +1 @@
extern int dummy;