Increase Coverage.

This commit is contained in:
Sebastien Barre 2002-01-20 01:58:57 -05:00
parent f04128ad63
commit 6f3570656c
21 changed files with 377 additions and 13 deletions

View File

@ -46,7 +46,7 @@ INCLUDE_DIRECTORIES(BEFORE
${Complex_BINARY_DIR}
)
INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$")
INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$" ".*")
LINK_DIRECTORIES(
${Complex_BINARY_DIR}/Library

View File

@ -17,7 +17,11 @@ FIND_LIBRARY(CMAKE_LIB
${Complex_BINARY_DIR}/../../Source/MinSizeRel
${Complex_BINARY_DIR}/../../Source/RelWithDebInfo)
TARGET_LINK_LIBRARIES(complex ${CMAKE_LIB})
# Specify the same one for debug/optimized to increase coverage
TARGET_LINK_LIBRARIES(complex
${CMAKE_LIB}
debug ${CMAKE_LIB}
optimized ${CMAKE_LIB})
#
# Output the files required by 'complex' to a file.

View File

@ -157,6 +157,30 @@ int main()
// ----------------------------------------------------------------------
// Test various IF/ELSE combinations
#ifdef SHOULD_NOT_BE_DEFINED_NOT
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_NOT is defined.");
#else
cmPassed("SHOULD_NOT_BE_DEFINED_NOT is not defined.");
#endif
#ifndef SHOULD_BE_DEFINED_NOT
cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_NOT is not defined.\n");
#else
cmPassed("SHOULD_BE_DEFINED_NOT is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_NOT2
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_NOT2 is defined.");
#else
cmPassed("SHOULD_NOT_BE_DEFINED_NOT2 is not defined.");
#endif
#ifndef SHOULD_BE_DEFINED_NOT2
cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_NOT2 is not defined.\n");
#else
cmPassed("SHOULD_BE_DEFINED_NOT2 is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_AND
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND is defined.");
#else
@ -169,6 +193,18 @@ int main()
cmPassed("SHOULD_BE_DEFINED_AND is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_AND2
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND2 is defined.");
#else
cmPassed("SHOULD_NOT_BE_DEFINED_AND2 is not defined.");
#endif
#ifndef SHOULD_BE_DEFINED_AND2
cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_AND2 is not defined.\n");
#else
cmPassed("SHOULD_BE_DEFINED_AND2 is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_OR
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR is defined.");
#else
@ -181,6 +217,18 @@ int main()
cmPassed("SHOULD_BE_DEFINED_OR is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_OR2
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR2 is defined.");
#else
cmPassed("SHOULD_NOT_BE_DEFINED_OR2 is not defined.");
#endif
#ifndef SHOULD_BE_DEFINED_OR2
cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_OR2 is not defined.\n");
#else
cmPassed("SHOULD_BE_DEFINED_OR2 is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_MATCHES
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES is defined.");
#else
@ -193,6 +241,18 @@ int main()
cmPassed("SHOULD_BE_DEFINED_MATCHES is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_MATCHES2
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES2 is defined.");
#else
cmPassed("SHOULD_NOT_BE_DEFINED_MATCHES2 is not defined.");
#endif
#ifndef SHOULD_BE_DEFINED_MATCHES2
cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_MATCHES2 is not defined.\n");
#else
cmPassed("SHOULD_BE_DEFINED_MATCHES2 is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_COMMAND
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_COMMAND is defined.");
#else
@ -205,6 +265,18 @@ int main()
cmPassed("SHOULD_BE_DEFINED_COMMAND is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_COMMAND2
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_COMMAND2 is defined.");
#else
cmPassed("SHOULD_NOT_BE_DEFINED_COMMAND2 is not defined.");
#endif
#ifndef SHOULD_BE_DEFINED_COMMAND2
cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_COMMAND2 is not defined.\n");
#else
cmPassed("SHOULD_BE_DEFINED_COMMAND2 is defined.");
#endif
// ----------------------------------------------------------------------
// Test FOREACH

View File

@ -8,10 +8,15 @@ ADD_EXECUTABLE(create_file create_file.cxx)
#
# Create static library
# SOURCE_FILES_REMOVE is used for Coverage
# SOURCE_FILES_REMOVE is used for Coverage. empty.h is included for coverage
#
AUX_SOURCE_DIRECTORY(ExtraSources LibrarySources)
SOURCE_FILES(LibrarySources file2 create_file.cxx GENERATED nonexisting_file)
SOURCE_FILES(LibrarySources
file2
empty
create_file.cxx
GENERATED
nonexisting_file)
SOURCE_FILES_REMOVE(LibrarySources create_file.cxx GENERATED nonexisting_file)
ADD_LIBRARY(CMakeTestLibrary LibrarySources)

View File

@ -0,0 +1 @@
int file2();

View File

@ -2,6 +2,7 @@
# Test SET
#
SET (ZERO_VAR 0)
SET (ZERO_VAR2 0)
IF(ZERO_VAR)
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED)
@ -22,30 +23,66 @@ VARIABLE_REQUIRES(ONE_VAR
#
# Test various IF/ELSE combinations
#
IF(NOT ZERO_VAR)
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_NOT)
ELSE(NOT ZERO_VAR)
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_NOT)
ENDIF(NOT ZERO_VAR)
IF(NOT ONE_VAR)
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_NOT2)
ELSE(NOT ONE_VAR)
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_NOT2)
ENDIF(NOT ONE_VAR)
IF(ONE_VAR AND ONE_VAR2)
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_AND)
ELSE(ONE_VAR AND ONE_VAR2)
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_AND)
ENDIF(ONE_VAR AND ONE_VAR2)
IF(ONE_VAR AND ZERO_VAR)
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_AND2)
ELSE(ONE_VAR AND ZERO_VAR)
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_AND2)
ENDIF(ONE_VAR AND ZERO_VAR)
IF(ZERO_VAR OR ONE_VAR2)
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_OR)
ELSE(ZERO_VAR OR ONE_VAR2)
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_OR)
ENDIF(ZERO_VAR OR ONE_VAR2)
IF(ZERO_VAR OR ZERO_VAR2)
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_OR2)
ELSE(ZERO_VAR OR ZERO_VAR2)
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_OR2)
ENDIF(ZERO_VAR OR ZERO_VAR2)
IF(STRING_VAR MATCHES "^CMake")
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_MATCHES)
ELSE(STRING_VAR MATCHES "^CMake")
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_MATCHES)
ENDIF(STRING_VAR MATCHES "^CMake")
IF(STRING_VAR MATCHES "^foo")
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_MATCHES2)
ELSE(STRING_VAR MATCHES "^foo")
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_MATCHES2)
ENDIF(STRING_VAR MATCHES "^foo")
IF(COMMAND "IF")
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_COMMAND)
ELSE(COMMAND "IF")
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_COMMAND)
ENDIF(COMMAND "IF")
IF(COMMAND "ROQUEFORT")
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_COMMAND2)
ELSE(COMMAND "ROQUEFORT")
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_COMMAND2)
ENDIF(COMMAND "ROQUEFORT")
#
# Test FOREACH
#

View File

@ -46,7 +46,7 @@ INCLUDE_DIRECTORIES(BEFORE
${Complex_BINARY_DIR}
)
INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$")
INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$" ".*")
LINK_DIRECTORIES(
${Complex_BINARY_DIR}/Library

View File

@ -17,7 +17,11 @@ FIND_LIBRARY(CMAKE_LIB
${Complex_BINARY_DIR}/../../Source/MinSizeRel
${Complex_BINARY_DIR}/../../Source/RelWithDebInfo)
TARGET_LINK_LIBRARIES(complex ${CMAKE_LIB})
# Specify the same one for debug/optimized to increase coverage
TARGET_LINK_LIBRARIES(complex
${CMAKE_LIB}
debug ${CMAKE_LIB}
optimized ${CMAKE_LIB})
#
# Output the files required by 'complex' to a file.

View File

@ -157,6 +157,30 @@ int main()
// ----------------------------------------------------------------------
// Test various IF/ELSE combinations
#ifdef SHOULD_NOT_BE_DEFINED_NOT
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_NOT is defined.");
#else
cmPassed("SHOULD_NOT_BE_DEFINED_NOT is not defined.");
#endif
#ifndef SHOULD_BE_DEFINED_NOT
cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_NOT is not defined.\n");
#else
cmPassed("SHOULD_BE_DEFINED_NOT is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_NOT2
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_NOT2 is defined.");
#else
cmPassed("SHOULD_NOT_BE_DEFINED_NOT2 is not defined.");
#endif
#ifndef SHOULD_BE_DEFINED_NOT2
cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_NOT2 is not defined.\n");
#else
cmPassed("SHOULD_BE_DEFINED_NOT2 is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_AND
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND is defined.");
#else
@ -169,6 +193,18 @@ int main()
cmPassed("SHOULD_BE_DEFINED_AND is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_AND2
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND2 is defined.");
#else
cmPassed("SHOULD_NOT_BE_DEFINED_AND2 is not defined.");
#endif
#ifndef SHOULD_BE_DEFINED_AND2
cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_AND2 is not defined.\n");
#else
cmPassed("SHOULD_BE_DEFINED_AND2 is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_OR
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR is defined.");
#else
@ -181,6 +217,18 @@ int main()
cmPassed("SHOULD_BE_DEFINED_OR is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_OR2
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR2 is defined.");
#else
cmPassed("SHOULD_NOT_BE_DEFINED_OR2 is not defined.");
#endif
#ifndef SHOULD_BE_DEFINED_OR2
cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_OR2 is not defined.\n");
#else
cmPassed("SHOULD_BE_DEFINED_OR2 is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_MATCHES
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES is defined.");
#else
@ -193,6 +241,18 @@ int main()
cmPassed("SHOULD_BE_DEFINED_MATCHES is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_MATCHES2
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES2 is defined.");
#else
cmPassed("SHOULD_NOT_BE_DEFINED_MATCHES2 is not defined.");
#endif
#ifndef SHOULD_BE_DEFINED_MATCHES2
cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_MATCHES2 is not defined.\n");
#else
cmPassed("SHOULD_BE_DEFINED_MATCHES2 is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_COMMAND
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_COMMAND is defined.");
#else
@ -205,6 +265,18 @@ int main()
cmPassed("SHOULD_BE_DEFINED_COMMAND is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_COMMAND2
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_COMMAND2 is defined.");
#else
cmPassed("SHOULD_NOT_BE_DEFINED_COMMAND2 is not defined.");
#endif
#ifndef SHOULD_BE_DEFINED_COMMAND2
cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_COMMAND2 is not defined.\n");
#else
cmPassed("SHOULD_BE_DEFINED_COMMAND2 is defined.");
#endif
// ----------------------------------------------------------------------
// Test FOREACH

View File

@ -8,10 +8,15 @@ ADD_EXECUTABLE(create_file create_file.cxx)
#
# Create static library
# SOURCE_FILES_REMOVE is used for Coverage
# SOURCE_FILES_REMOVE is used for Coverage. empty.h is included for coverage
#
AUX_SOURCE_DIRECTORY(ExtraSources LibrarySources)
SOURCE_FILES(LibrarySources file2 create_file.cxx GENERATED nonexisting_file)
SOURCE_FILES(LibrarySources
file2
empty
create_file.cxx
GENERATED
nonexisting_file)
SOURCE_FILES_REMOVE(LibrarySources create_file.cxx GENERATED nonexisting_file)
ADD_LIBRARY(CMakeTestLibrary LibrarySources)

View File

@ -0,0 +1 @@
int file2();

View File

@ -2,6 +2,7 @@
# Test SET
#
SET (ZERO_VAR 0)
SET (ZERO_VAR2 0)
IF(ZERO_VAR)
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED)
@ -22,30 +23,66 @@ VARIABLE_REQUIRES(ONE_VAR
#
# Test various IF/ELSE combinations
#
IF(NOT ZERO_VAR)
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_NOT)
ELSE(NOT ZERO_VAR)
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_NOT)
ENDIF(NOT ZERO_VAR)
IF(NOT ONE_VAR)
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_NOT2)
ELSE(NOT ONE_VAR)
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_NOT2)
ENDIF(NOT ONE_VAR)
IF(ONE_VAR AND ONE_VAR2)
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_AND)
ELSE(ONE_VAR AND ONE_VAR2)
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_AND)
ENDIF(ONE_VAR AND ONE_VAR2)
IF(ONE_VAR AND ZERO_VAR)
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_AND2)
ELSE(ONE_VAR AND ZERO_VAR)
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_AND2)
ENDIF(ONE_VAR AND ZERO_VAR)
IF(ZERO_VAR OR ONE_VAR2)
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_OR)
ELSE(ZERO_VAR OR ONE_VAR2)
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_OR)
ENDIF(ZERO_VAR OR ONE_VAR2)
IF(ZERO_VAR OR ZERO_VAR2)
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_OR2)
ELSE(ZERO_VAR OR ZERO_VAR2)
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_OR2)
ENDIF(ZERO_VAR OR ZERO_VAR2)
IF(STRING_VAR MATCHES "^CMake")
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_MATCHES)
ELSE(STRING_VAR MATCHES "^CMake")
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_MATCHES)
ENDIF(STRING_VAR MATCHES "^CMake")
IF(STRING_VAR MATCHES "^foo")
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_MATCHES2)
ELSE(STRING_VAR MATCHES "^foo")
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_MATCHES2)
ENDIF(STRING_VAR MATCHES "^foo")
IF(COMMAND "IF")
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_COMMAND)
ELSE(COMMAND "IF")
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_COMMAND)
ENDIF(COMMAND "IF")
IF(COMMAND "ROQUEFORT")
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_COMMAND2)
ELSE(COMMAND "ROQUEFORT")
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_COMMAND2)
ENDIF(COMMAND "ROQUEFORT")
#
# Test FOREACH
#

View File

@ -46,7 +46,7 @@ INCLUDE_DIRECTORIES(BEFORE
${Complex_BINARY_DIR}
)
INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$")
INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$" ".*")
LINK_DIRECTORIES(
${Complex_BINARY_DIR}/Library

View File

@ -17,7 +17,11 @@ FIND_LIBRARY(CMAKE_LIB
${Complex_BINARY_DIR}/../../Source/MinSizeRel
${Complex_BINARY_DIR}/../../Source/RelWithDebInfo)
TARGET_LINK_LIBRARIES(complex ${CMAKE_LIB})
# Specify the same one for debug/optimized to increase coverage
TARGET_LINK_LIBRARIES(complex
${CMAKE_LIB}
debug ${CMAKE_LIB}
optimized ${CMAKE_LIB})
#
# Output the files required by 'complex' to a file.

View File

@ -157,6 +157,30 @@ int main()
// ----------------------------------------------------------------------
// Test various IF/ELSE combinations
#ifdef SHOULD_NOT_BE_DEFINED_NOT
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_NOT is defined.");
#else
cmPassed("SHOULD_NOT_BE_DEFINED_NOT is not defined.");
#endif
#ifndef SHOULD_BE_DEFINED_NOT
cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_NOT is not defined.\n");
#else
cmPassed("SHOULD_BE_DEFINED_NOT is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_NOT2
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_NOT2 is defined.");
#else
cmPassed("SHOULD_NOT_BE_DEFINED_NOT2 is not defined.");
#endif
#ifndef SHOULD_BE_DEFINED_NOT2
cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_NOT2 is not defined.\n");
#else
cmPassed("SHOULD_BE_DEFINED_NOT2 is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_AND
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND is defined.");
#else
@ -169,6 +193,18 @@ int main()
cmPassed("SHOULD_BE_DEFINED_AND is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_AND2
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND2 is defined.");
#else
cmPassed("SHOULD_NOT_BE_DEFINED_AND2 is not defined.");
#endif
#ifndef SHOULD_BE_DEFINED_AND2
cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_AND2 is not defined.\n");
#else
cmPassed("SHOULD_BE_DEFINED_AND2 is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_OR
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR is defined.");
#else
@ -181,6 +217,18 @@ int main()
cmPassed("SHOULD_BE_DEFINED_OR is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_OR2
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR2 is defined.");
#else
cmPassed("SHOULD_NOT_BE_DEFINED_OR2 is not defined.");
#endif
#ifndef SHOULD_BE_DEFINED_OR2
cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_OR2 is not defined.\n");
#else
cmPassed("SHOULD_BE_DEFINED_OR2 is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_MATCHES
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES is defined.");
#else
@ -193,6 +241,18 @@ int main()
cmPassed("SHOULD_BE_DEFINED_MATCHES is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_MATCHES2
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES2 is defined.");
#else
cmPassed("SHOULD_NOT_BE_DEFINED_MATCHES2 is not defined.");
#endif
#ifndef SHOULD_BE_DEFINED_MATCHES2
cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_MATCHES2 is not defined.\n");
#else
cmPassed("SHOULD_BE_DEFINED_MATCHES2 is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_COMMAND
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_COMMAND is defined.");
#else
@ -205,6 +265,18 @@ int main()
cmPassed("SHOULD_BE_DEFINED_COMMAND is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_COMMAND2
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_COMMAND2 is defined.");
#else
cmPassed("SHOULD_NOT_BE_DEFINED_COMMAND2 is not defined.");
#endif
#ifndef SHOULD_BE_DEFINED_COMMAND2
cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_COMMAND2 is not defined.\n");
#else
cmPassed("SHOULD_BE_DEFINED_COMMAND2 is defined.");
#endif
// ----------------------------------------------------------------------
// Test FOREACH

View File

@ -8,10 +8,15 @@ ADD_EXECUTABLE(create_file create_file.cxx)
#
# Create static library
# SOURCE_FILES_REMOVE is used for Coverage
# SOURCE_FILES_REMOVE is used for Coverage. empty.h is included for coverage
#
AUX_SOURCE_DIRECTORY(ExtraSources LibrarySources)
SOURCE_FILES(LibrarySources file2 create_file.cxx GENERATED nonexisting_file)
SOURCE_FILES(LibrarySources
file2
empty
create_file.cxx
GENERATED
nonexisting_file)
SOURCE_FILES_REMOVE(LibrarySources create_file.cxx GENERATED nonexisting_file)
ADD_LIBRARY(CMakeTestLibrary LibrarySources)

View File

@ -0,0 +1 @@
int file2();

View File

@ -2,6 +2,7 @@
# Test SET
#
SET (ZERO_VAR 0)
SET (ZERO_VAR2 0)
IF(ZERO_VAR)
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED)
@ -22,30 +23,66 @@ VARIABLE_REQUIRES(ONE_VAR
#
# Test various IF/ELSE combinations
#
IF(NOT ZERO_VAR)
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_NOT)
ELSE(NOT ZERO_VAR)
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_NOT)
ENDIF(NOT ZERO_VAR)
IF(NOT ONE_VAR)
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_NOT2)
ELSE(NOT ONE_VAR)
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_NOT2)
ENDIF(NOT ONE_VAR)
IF(ONE_VAR AND ONE_VAR2)
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_AND)
ELSE(ONE_VAR AND ONE_VAR2)
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_AND)
ENDIF(ONE_VAR AND ONE_VAR2)
IF(ONE_VAR AND ZERO_VAR)
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_AND2)
ELSE(ONE_VAR AND ZERO_VAR)
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_AND2)
ENDIF(ONE_VAR AND ZERO_VAR)
IF(ZERO_VAR OR ONE_VAR2)
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_OR)
ELSE(ZERO_VAR OR ONE_VAR2)
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_OR)
ENDIF(ZERO_VAR OR ONE_VAR2)
IF(ZERO_VAR OR ZERO_VAR2)
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_OR2)
ELSE(ZERO_VAR OR ZERO_VAR2)
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_OR2)
ENDIF(ZERO_VAR OR ZERO_VAR2)
IF(STRING_VAR MATCHES "^CMake")
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_MATCHES)
ELSE(STRING_VAR MATCHES "^CMake")
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_MATCHES)
ENDIF(STRING_VAR MATCHES "^CMake")
IF(STRING_VAR MATCHES "^foo")
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_MATCHES2)
ELSE(STRING_VAR MATCHES "^foo")
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_MATCHES2)
ENDIF(STRING_VAR MATCHES "^foo")
IF(COMMAND "IF")
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_COMMAND)
ELSE(COMMAND "IF")
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_COMMAND)
ENDIF(COMMAND "IF")
IF(COMMAND "ROQUEFORT")
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_COMMAND2)
ELSE(COMMAND "ROQUEFORT")
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_COMMAND2)
ENDIF(COMMAND "ROQUEFORT")
#
# Test FOREACH
#

View File

@ -34,7 +34,10 @@ FIND_LIBRARY(CMAKE_LIB
${Testing_BINARY_DIR}/../../Source/MinSizeRel
${Testing_BINARY_DIR}/../../Source/RelWithDebInfo)
LINK_LIBRARIES(${CMAKE_LIB})
# Specify the same one for debug/optimized to increase coverage
LINK_LIBRARIES(${CMAKE_LIB}
debug ${CMAKE_LIB}
optimized ${CMAKE_LIB})
#
# Include Dart

View File

@ -0,0 +1,2 @@
// A comment
// Another comment

View File

@ -0,0 +1,2 @@
// A comment
// Another comment (force coverage)