ENH: Increase test + coverage
This commit is contained in:
parent
2b5bb96e23
commit
c26008ccf3
|
@ -12,7 +12,9 @@ ENDIF (CMAKE_ANSI_CXXFLAGS)
|
||||||
|
|
||||||
ADD_DEFINITIONS(-DCMAKE_IS_FUN)
|
ADD_DEFINITIONS(-DCMAKE_IS_FUN)
|
||||||
|
|
||||||
INCLUDE(${Complex_SOURCE_DIR}/VarTests.txt)
|
IF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake)
|
||||||
|
INCLUDE(${Complex_SOURCE_DIR}/VarTests.cmake)
|
||||||
|
ENDIF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake)
|
||||||
|
|
||||||
LOAD_CACHE(${Complex_SOURCE_DIR})
|
LOAD_CACHE(${Complex_SOURCE_DIR})
|
||||||
|
|
||||||
|
@ -53,13 +55,18 @@ SUBDIRS(Library Executable)
|
||||||
SUBDIR_DEPENDS(Executable Library)
|
SUBDIR_DEPENDS(Executable Library)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Exec program
|
# Exec program (TODO: test a result)
|
||||||
# Increase coverage.
|
# Increase coverage.
|
||||||
#
|
#
|
||||||
OPTION(EXEC_PROGRAM "Test EXEC_PROGRAM" ON)
|
OPTION(NO_EXEC_PROGRAM "Do not test EXEC_PROGRAM" 0)
|
||||||
IF (EXEC_PROGRAM)
|
IF (NOT NO_EXEC_PROGRAM)
|
||||||
EXEC_PROGRAM("echo EXEC_PROGRAM")
|
EXEC_PROGRAM("echo NO_EXEC_PROGRAM" "${Complex_BINARY_DIR}")
|
||||||
ENDIF (EXEC_PROGRAM)
|
ELSE (NOT NO_EXEC_PROGRAM)
|
||||||
|
MESSAGE("Set this option ON")
|
||||||
|
ENDIF (NOT NO_EXEC_PROGRAM)
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(NO_EXEC_PROGRAM)
|
||||||
|
MARK_AS_ADVANCED(CLEAR NO_EXEC_PROGRAM)
|
||||||
|
|
||||||
#
|
#
|
||||||
# More coverage
|
# More coverage
|
||||||
|
@ -77,6 +84,11 @@ INSTALL_FILES(/tmp .h ${Complex_BINARY_DIR}/cmTestConfigure.h)
|
||||||
#
|
#
|
||||||
MAKE_DIRECTORY("${Complex_BINARY_DIR}/make_dir")
|
MAKE_DIRECTORY("${Complex_BINARY_DIR}/make_dir")
|
||||||
|
|
||||||
|
#
|
||||||
|
# Testing
|
||||||
|
#
|
||||||
|
ENABLE_TESTING()
|
||||||
|
|
||||||
#
|
#
|
||||||
# Test Cable
|
# Test Cable
|
||||||
#
|
#
|
||||||
|
|
|
@ -14,7 +14,13 @@ FIND_LIBRARY(CMAKE_LIB
|
||||||
TARGET_LINK_LIBRARIES(complex ${CMAKE_LIB})
|
TARGET_LINK_LIBRARIES(complex ${CMAKE_LIB})
|
||||||
LINK_LIBRARIES(${CMAKE_LIB})
|
LINK_LIBRARIES(${CMAKE_LIB})
|
||||||
|
|
||||||
# More coverage
|
#
|
||||||
|
# Testing
|
||||||
|
#
|
||||||
|
ADD_TEST(complex ${Complex_BINARY_DIR}/bin/complex)
|
||||||
|
|
||||||
|
#
|
||||||
|
# More coverage
|
||||||
|
#
|
||||||
INSTALL_TARGETS(/tmp complex)
|
INSTALL_TARGETS(/tmp complex)
|
||||||
INSTALL_PROGRAMS(/tmp complex)
|
INSTALL_PROGRAMS(/tmp complex)
|
||||||
|
|
|
@ -106,6 +106,42 @@ int main()
|
||||||
Passed("SHOULD_BE_DEFINED is defined.");
|
Passed("SHOULD_BE_DEFINED is defined.");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef SHOULD_NOT_BE_DEFINED_AND
|
||||||
|
Failed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND is defined.");
|
||||||
|
#else
|
||||||
|
Passed("SHOULD_NOT_BE_DEFINED_AND is not defined.");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SHOULD_BE_DEFINED_AND
|
||||||
|
Failed("IF or SET is broken, SHOULD_BE_DEFINED_AND is not defined.\n");
|
||||||
|
#else
|
||||||
|
Passed("SHOULD_BE_DEFINED_AND is defined.");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SHOULD_NOT_BE_DEFINED_OR
|
||||||
|
Failed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR is defined.");
|
||||||
|
#else
|
||||||
|
Passed("SHOULD_NOT_BE_DEFINED_OR is not defined.");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SHOULD_BE_DEFINED_OR
|
||||||
|
Failed("IF or SET is broken, SHOULD_BE_DEFINED_OR is not defined.\n");
|
||||||
|
#else
|
||||||
|
Passed("SHOULD_BE_DEFINED_OR is defined.");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SHOULD_NOT_BE_DEFINED_MATCHES
|
||||||
|
Failed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES is defined.");
|
||||||
|
#else
|
||||||
|
Passed("SHOULD_NOT_BE_DEFINED_MATCHES is not defined.");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SHOULD_BE_DEFINED_MATCHES
|
||||||
|
Failed("IF or SET is broken, SHOULD_BE_DEFINED_MATCHES is not defined.\n");
|
||||||
|
#else
|
||||||
|
Passed("SHOULD_BE_DEFINED_MATCHES is defined.");
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef ONE_VAR
|
#ifndef ONE_VAR
|
||||||
Failed("cmakedefine is broken, ONE_VAR is not defined.");
|
Failed("cmakedefine is broken, ONE_VAR is not defined.");
|
||||||
#else
|
#else
|
||||||
|
@ -188,7 +224,7 @@ int main()
|
||||||
Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, "
|
Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, "
|
||||||
"FILENAME_VAR_NAME is not defined.");
|
"FILENAME_VAR_NAME is not defined.");
|
||||||
#else
|
#else
|
||||||
if(strcmp(FILENAME_VAR_NAME, "VarTests.txt") != 0)
|
if(strcmp(FILENAME_VAR_NAME, "VarTests.cmake") != 0)
|
||||||
{
|
{
|
||||||
Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, "
|
Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, "
|
||||||
"FILENAME_VAR_NAME == ", FILENAME_VAR_NAME);
|
"FILENAME_VAR_NAME == ", FILENAME_VAR_NAME);
|
||||||
|
@ -203,7 +239,7 @@ int main()
|
||||||
Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, "
|
Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, "
|
||||||
"FILENAME_VAR_EXT is not defined.");
|
"FILENAME_VAR_EXT is not defined.");
|
||||||
#else
|
#else
|
||||||
if(strcmp(FILENAME_VAR_EXT, ".txt") != 0)
|
if(strcmp(FILENAME_VAR_EXT, ".cmake") != 0)
|
||||||
{
|
{
|
||||||
Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, "
|
Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, "
|
||||||
"FILENAME_VAR_EXT == ", FILENAME_VAR_EXT);
|
"FILENAME_VAR_EXT == ", FILENAME_VAR_EXT);
|
||||||
|
|
|
@ -11,13 +11,33 @@ SET(ONE_VAR 1)
|
||||||
VARIABLE_REQUIRES(ONE_VAR
|
VARIABLE_REQUIRES(ONE_VAR
|
||||||
ONE_VAR_IS_DEFINED ONE_VAR)
|
ONE_VAR_IS_DEFINED ONE_VAR)
|
||||||
|
|
||||||
|
SET (ONE_VAR2 1)
|
||||||
|
|
||||||
|
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(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)
|
||||||
|
|
||||||
SET(STRING_VAR "CMake is great" CACHE STRING "test a cache variable")
|
SET(STRING_VAR "CMake is great" CACHE STRING "test a cache variable")
|
||||||
|
|
||||||
|
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")
|
||||||
|
|
||||||
FOREACH (INDEX 1 2)
|
FOREACH (INDEX 1 2)
|
||||||
SET(FOREACH_VAR${INDEX} "VALUE${INDEX}")
|
SET(FOREACH_VAR${INDEX} "VALUE${INDEX}")
|
||||||
ENDFOREACH(INDEX)
|
ENDFOREACH(INDEX)
|
||||||
|
|
||||||
FIND_FILE(FILENAME_VAR "VarTests.txt" ${Complex_SOURCE_DIR})
|
FIND_FILE(FILENAME_VAR "VarTests.cmake" ${Complex_SOURCE_DIR})
|
||||||
|
|
||||||
GET_FILENAME_COMPONENT(FILENAME_VAR_PATH ${FILENAME_VAR} PATH)
|
GET_FILENAME_COMPONENT(FILENAME_VAR_PATH ${FILENAME_VAR} PATH)
|
||||||
GET_FILENAME_COMPONENT(FILENAME_VAR_PATH_NAME ${FILENAME_VAR_PATH} NAME)
|
GET_FILENAME_COMPONENT(FILENAME_VAR_PATH_NAME ${FILENAME_VAR_PATH} NAME)
|
||||||
|
@ -25,7 +45,7 @@ GET_FILENAME_COMPONENT(FILENAME_VAR_NAME ${FILENAME_VAR} NAME)
|
||||||
GET_FILENAME_COMPONENT(FILENAME_VAR_EXT ${FILENAME_VAR} EXT)
|
GET_FILENAME_COMPONENT(FILENAME_VAR_EXT ${FILENAME_VAR} EXT)
|
||||||
GET_FILENAME_COMPONENT(FILENAME_VAR_NAME_WE ${FILENAME_VAR} NAME_WE)
|
GET_FILENAME_COMPONENT(FILENAME_VAR_NAME_WE ${FILENAME_VAR} NAME_WE)
|
||||||
|
|
||||||
FIND_PATH(PATH_VAR "VarTests.txt" ${Complex_SOURCE_DIR})
|
FIND_PATH(PATH_VAR "VarTests.cmake" ${Complex_SOURCE_DIR})
|
||||||
GET_FILENAME_COMPONENT(PATH_VAR_NAME ${PATH_VAR} NAME)
|
GET_FILENAME_COMPONENT(PATH_VAR_NAME ${PATH_VAR} NAME)
|
||||||
|
|
||||||
# Coverage only
|
# Coverage only
|
|
@ -12,7 +12,9 @@ ENDIF (CMAKE_ANSI_CXXFLAGS)
|
||||||
|
|
||||||
ADD_DEFINITIONS(-DCMAKE_IS_FUN)
|
ADD_DEFINITIONS(-DCMAKE_IS_FUN)
|
||||||
|
|
||||||
INCLUDE(${Complex_SOURCE_DIR}/VarTests.txt)
|
IF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake)
|
||||||
|
INCLUDE(${Complex_SOURCE_DIR}/VarTests.cmake)
|
||||||
|
ENDIF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake)
|
||||||
|
|
||||||
LOAD_CACHE(${Complex_SOURCE_DIR})
|
LOAD_CACHE(${Complex_SOURCE_DIR})
|
||||||
|
|
||||||
|
@ -53,13 +55,18 @@ SUBDIRS(Library Executable)
|
||||||
SUBDIR_DEPENDS(Executable Library)
|
SUBDIR_DEPENDS(Executable Library)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Exec program
|
# Exec program (TODO: test a result)
|
||||||
# Increase coverage.
|
# Increase coverage.
|
||||||
#
|
#
|
||||||
OPTION(EXEC_PROGRAM "Test EXEC_PROGRAM" ON)
|
OPTION(NO_EXEC_PROGRAM "Do not test EXEC_PROGRAM" 0)
|
||||||
IF (EXEC_PROGRAM)
|
IF (NOT NO_EXEC_PROGRAM)
|
||||||
EXEC_PROGRAM("echo EXEC_PROGRAM")
|
EXEC_PROGRAM("echo NO_EXEC_PROGRAM" "${Complex_BINARY_DIR}")
|
||||||
ENDIF (EXEC_PROGRAM)
|
ELSE (NOT NO_EXEC_PROGRAM)
|
||||||
|
MESSAGE("Set this option ON")
|
||||||
|
ENDIF (NOT NO_EXEC_PROGRAM)
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(NO_EXEC_PROGRAM)
|
||||||
|
MARK_AS_ADVANCED(CLEAR NO_EXEC_PROGRAM)
|
||||||
|
|
||||||
#
|
#
|
||||||
# More coverage
|
# More coverage
|
||||||
|
@ -77,6 +84,11 @@ INSTALL_FILES(/tmp .h ${Complex_BINARY_DIR}/cmTestConfigure.h)
|
||||||
#
|
#
|
||||||
MAKE_DIRECTORY("${Complex_BINARY_DIR}/make_dir")
|
MAKE_DIRECTORY("${Complex_BINARY_DIR}/make_dir")
|
||||||
|
|
||||||
|
#
|
||||||
|
# Testing
|
||||||
|
#
|
||||||
|
ENABLE_TESTING()
|
||||||
|
|
||||||
#
|
#
|
||||||
# Test Cable
|
# Test Cable
|
||||||
#
|
#
|
||||||
|
|
|
@ -14,7 +14,13 @@ FIND_LIBRARY(CMAKE_LIB
|
||||||
TARGET_LINK_LIBRARIES(complex ${CMAKE_LIB})
|
TARGET_LINK_LIBRARIES(complex ${CMAKE_LIB})
|
||||||
LINK_LIBRARIES(${CMAKE_LIB})
|
LINK_LIBRARIES(${CMAKE_LIB})
|
||||||
|
|
||||||
# More coverage
|
#
|
||||||
|
# Testing
|
||||||
|
#
|
||||||
|
ADD_TEST(complex ${Complex_BINARY_DIR}/bin/complex)
|
||||||
|
|
||||||
|
#
|
||||||
|
# More coverage
|
||||||
|
#
|
||||||
INSTALL_TARGETS(/tmp complex)
|
INSTALL_TARGETS(/tmp complex)
|
||||||
INSTALL_PROGRAMS(/tmp complex)
|
INSTALL_PROGRAMS(/tmp complex)
|
||||||
|
|
|
@ -106,6 +106,42 @@ int main()
|
||||||
Passed("SHOULD_BE_DEFINED is defined.");
|
Passed("SHOULD_BE_DEFINED is defined.");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef SHOULD_NOT_BE_DEFINED_AND
|
||||||
|
Failed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND is defined.");
|
||||||
|
#else
|
||||||
|
Passed("SHOULD_NOT_BE_DEFINED_AND is not defined.");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SHOULD_BE_DEFINED_AND
|
||||||
|
Failed("IF or SET is broken, SHOULD_BE_DEFINED_AND is not defined.\n");
|
||||||
|
#else
|
||||||
|
Passed("SHOULD_BE_DEFINED_AND is defined.");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SHOULD_NOT_BE_DEFINED_OR
|
||||||
|
Failed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR is defined.");
|
||||||
|
#else
|
||||||
|
Passed("SHOULD_NOT_BE_DEFINED_OR is not defined.");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SHOULD_BE_DEFINED_OR
|
||||||
|
Failed("IF or SET is broken, SHOULD_BE_DEFINED_OR is not defined.\n");
|
||||||
|
#else
|
||||||
|
Passed("SHOULD_BE_DEFINED_OR is defined.");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SHOULD_NOT_BE_DEFINED_MATCHES
|
||||||
|
Failed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES is defined.");
|
||||||
|
#else
|
||||||
|
Passed("SHOULD_NOT_BE_DEFINED_MATCHES is not defined.");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SHOULD_BE_DEFINED_MATCHES
|
||||||
|
Failed("IF or SET is broken, SHOULD_BE_DEFINED_MATCHES is not defined.\n");
|
||||||
|
#else
|
||||||
|
Passed("SHOULD_BE_DEFINED_MATCHES is defined.");
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef ONE_VAR
|
#ifndef ONE_VAR
|
||||||
Failed("cmakedefine is broken, ONE_VAR is not defined.");
|
Failed("cmakedefine is broken, ONE_VAR is not defined.");
|
||||||
#else
|
#else
|
||||||
|
@ -188,7 +224,7 @@ int main()
|
||||||
Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, "
|
Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, "
|
||||||
"FILENAME_VAR_NAME is not defined.");
|
"FILENAME_VAR_NAME is not defined.");
|
||||||
#else
|
#else
|
||||||
if(strcmp(FILENAME_VAR_NAME, "VarTests.txt") != 0)
|
if(strcmp(FILENAME_VAR_NAME, "VarTests.cmake") != 0)
|
||||||
{
|
{
|
||||||
Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, "
|
Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, "
|
||||||
"FILENAME_VAR_NAME == ", FILENAME_VAR_NAME);
|
"FILENAME_VAR_NAME == ", FILENAME_VAR_NAME);
|
||||||
|
@ -203,7 +239,7 @@ int main()
|
||||||
Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, "
|
Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, "
|
||||||
"FILENAME_VAR_EXT is not defined.");
|
"FILENAME_VAR_EXT is not defined.");
|
||||||
#else
|
#else
|
||||||
if(strcmp(FILENAME_VAR_EXT, ".txt") != 0)
|
if(strcmp(FILENAME_VAR_EXT, ".cmake") != 0)
|
||||||
{
|
{
|
||||||
Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, "
|
Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, "
|
||||||
"FILENAME_VAR_EXT == ", FILENAME_VAR_EXT);
|
"FILENAME_VAR_EXT == ", FILENAME_VAR_EXT);
|
||||||
|
|
|
@ -11,13 +11,33 @@ SET(ONE_VAR 1)
|
||||||
VARIABLE_REQUIRES(ONE_VAR
|
VARIABLE_REQUIRES(ONE_VAR
|
||||||
ONE_VAR_IS_DEFINED ONE_VAR)
|
ONE_VAR_IS_DEFINED ONE_VAR)
|
||||||
|
|
||||||
|
SET (ONE_VAR2 1)
|
||||||
|
|
||||||
|
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(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)
|
||||||
|
|
||||||
SET(STRING_VAR "CMake is great" CACHE STRING "test a cache variable")
|
SET(STRING_VAR "CMake is great" CACHE STRING "test a cache variable")
|
||||||
|
|
||||||
|
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")
|
||||||
|
|
||||||
FOREACH (INDEX 1 2)
|
FOREACH (INDEX 1 2)
|
||||||
SET(FOREACH_VAR${INDEX} "VALUE${INDEX}")
|
SET(FOREACH_VAR${INDEX} "VALUE${INDEX}")
|
||||||
ENDFOREACH(INDEX)
|
ENDFOREACH(INDEX)
|
||||||
|
|
||||||
FIND_FILE(FILENAME_VAR "VarTests.txt" ${Complex_SOURCE_DIR})
|
FIND_FILE(FILENAME_VAR "VarTests.cmake" ${Complex_SOURCE_DIR})
|
||||||
|
|
||||||
GET_FILENAME_COMPONENT(FILENAME_VAR_PATH ${FILENAME_VAR} PATH)
|
GET_FILENAME_COMPONENT(FILENAME_VAR_PATH ${FILENAME_VAR} PATH)
|
||||||
GET_FILENAME_COMPONENT(FILENAME_VAR_PATH_NAME ${FILENAME_VAR_PATH} NAME)
|
GET_FILENAME_COMPONENT(FILENAME_VAR_PATH_NAME ${FILENAME_VAR_PATH} NAME)
|
||||||
|
@ -25,7 +45,7 @@ GET_FILENAME_COMPONENT(FILENAME_VAR_NAME ${FILENAME_VAR} NAME)
|
||||||
GET_FILENAME_COMPONENT(FILENAME_VAR_EXT ${FILENAME_VAR} EXT)
|
GET_FILENAME_COMPONENT(FILENAME_VAR_EXT ${FILENAME_VAR} EXT)
|
||||||
GET_FILENAME_COMPONENT(FILENAME_VAR_NAME_WE ${FILENAME_VAR} NAME_WE)
|
GET_FILENAME_COMPONENT(FILENAME_VAR_NAME_WE ${FILENAME_VAR} NAME_WE)
|
||||||
|
|
||||||
FIND_PATH(PATH_VAR "VarTests.txt" ${Complex_SOURCE_DIR})
|
FIND_PATH(PATH_VAR "VarTests.cmake" ${Complex_SOURCE_DIR})
|
||||||
GET_FILENAME_COMPONENT(PATH_VAR_NAME ${PATH_VAR} NAME)
|
GET_FILENAME_COMPONENT(PATH_VAR_NAME ${PATH_VAR} NAME)
|
||||||
|
|
||||||
# Coverage only
|
# Coverage only
|
|
@ -12,7 +12,9 @@ ENDIF (CMAKE_ANSI_CXXFLAGS)
|
||||||
|
|
||||||
ADD_DEFINITIONS(-DCMAKE_IS_FUN)
|
ADD_DEFINITIONS(-DCMAKE_IS_FUN)
|
||||||
|
|
||||||
INCLUDE(${Complex_SOURCE_DIR}/VarTests.txt)
|
IF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake)
|
||||||
|
INCLUDE(${Complex_SOURCE_DIR}/VarTests.cmake)
|
||||||
|
ENDIF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake)
|
||||||
|
|
||||||
LOAD_CACHE(${Complex_SOURCE_DIR})
|
LOAD_CACHE(${Complex_SOURCE_DIR})
|
||||||
|
|
||||||
|
@ -53,13 +55,18 @@ SUBDIRS(Library Executable)
|
||||||
SUBDIR_DEPENDS(Executable Library)
|
SUBDIR_DEPENDS(Executable Library)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Exec program
|
# Exec program (TODO: test a result)
|
||||||
# Increase coverage.
|
# Increase coverage.
|
||||||
#
|
#
|
||||||
OPTION(EXEC_PROGRAM "Test EXEC_PROGRAM" ON)
|
OPTION(NO_EXEC_PROGRAM "Do not test EXEC_PROGRAM" 0)
|
||||||
IF (EXEC_PROGRAM)
|
IF (NOT NO_EXEC_PROGRAM)
|
||||||
EXEC_PROGRAM("echo EXEC_PROGRAM")
|
EXEC_PROGRAM("echo NO_EXEC_PROGRAM" "${Complex_BINARY_DIR}")
|
||||||
ENDIF (EXEC_PROGRAM)
|
ELSE (NOT NO_EXEC_PROGRAM)
|
||||||
|
MESSAGE("Set this option ON")
|
||||||
|
ENDIF (NOT NO_EXEC_PROGRAM)
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(NO_EXEC_PROGRAM)
|
||||||
|
MARK_AS_ADVANCED(CLEAR NO_EXEC_PROGRAM)
|
||||||
|
|
||||||
#
|
#
|
||||||
# More coverage
|
# More coverage
|
||||||
|
@ -77,6 +84,11 @@ INSTALL_FILES(/tmp .h ${Complex_BINARY_DIR}/cmTestConfigure.h)
|
||||||
#
|
#
|
||||||
MAKE_DIRECTORY("${Complex_BINARY_DIR}/make_dir")
|
MAKE_DIRECTORY("${Complex_BINARY_DIR}/make_dir")
|
||||||
|
|
||||||
|
#
|
||||||
|
# Testing
|
||||||
|
#
|
||||||
|
ENABLE_TESTING()
|
||||||
|
|
||||||
#
|
#
|
||||||
# Test Cable
|
# Test Cable
|
||||||
#
|
#
|
||||||
|
|
|
@ -14,7 +14,13 @@ FIND_LIBRARY(CMAKE_LIB
|
||||||
TARGET_LINK_LIBRARIES(complex ${CMAKE_LIB})
|
TARGET_LINK_LIBRARIES(complex ${CMAKE_LIB})
|
||||||
LINK_LIBRARIES(${CMAKE_LIB})
|
LINK_LIBRARIES(${CMAKE_LIB})
|
||||||
|
|
||||||
# More coverage
|
#
|
||||||
|
# Testing
|
||||||
|
#
|
||||||
|
ADD_TEST(complex ${Complex_BINARY_DIR}/bin/complex)
|
||||||
|
|
||||||
|
#
|
||||||
|
# More coverage
|
||||||
|
#
|
||||||
INSTALL_TARGETS(/tmp complex)
|
INSTALL_TARGETS(/tmp complex)
|
||||||
INSTALL_PROGRAMS(/tmp complex)
|
INSTALL_PROGRAMS(/tmp complex)
|
||||||
|
|
|
@ -106,6 +106,42 @@ int main()
|
||||||
Passed("SHOULD_BE_DEFINED is defined.");
|
Passed("SHOULD_BE_DEFINED is defined.");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef SHOULD_NOT_BE_DEFINED_AND
|
||||||
|
Failed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND is defined.");
|
||||||
|
#else
|
||||||
|
Passed("SHOULD_NOT_BE_DEFINED_AND is not defined.");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SHOULD_BE_DEFINED_AND
|
||||||
|
Failed("IF or SET is broken, SHOULD_BE_DEFINED_AND is not defined.\n");
|
||||||
|
#else
|
||||||
|
Passed("SHOULD_BE_DEFINED_AND is defined.");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SHOULD_NOT_BE_DEFINED_OR
|
||||||
|
Failed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR is defined.");
|
||||||
|
#else
|
||||||
|
Passed("SHOULD_NOT_BE_DEFINED_OR is not defined.");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SHOULD_BE_DEFINED_OR
|
||||||
|
Failed("IF or SET is broken, SHOULD_BE_DEFINED_OR is not defined.\n");
|
||||||
|
#else
|
||||||
|
Passed("SHOULD_BE_DEFINED_OR is defined.");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SHOULD_NOT_BE_DEFINED_MATCHES
|
||||||
|
Failed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES is defined.");
|
||||||
|
#else
|
||||||
|
Passed("SHOULD_NOT_BE_DEFINED_MATCHES is not defined.");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SHOULD_BE_DEFINED_MATCHES
|
||||||
|
Failed("IF or SET is broken, SHOULD_BE_DEFINED_MATCHES is not defined.\n");
|
||||||
|
#else
|
||||||
|
Passed("SHOULD_BE_DEFINED_MATCHES is defined.");
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef ONE_VAR
|
#ifndef ONE_VAR
|
||||||
Failed("cmakedefine is broken, ONE_VAR is not defined.");
|
Failed("cmakedefine is broken, ONE_VAR is not defined.");
|
||||||
#else
|
#else
|
||||||
|
@ -188,7 +224,7 @@ int main()
|
||||||
Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, "
|
Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, "
|
||||||
"FILENAME_VAR_NAME is not defined.");
|
"FILENAME_VAR_NAME is not defined.");
|
||||||
#else
|
#else
|
||||||
if(strcmp(FILENAME_VAR_NAME, "VarTests.txt") != 0)
|
if(strcmp(FILENAME_VAR_NAME, "VarTests.cmake") != 0)
|
||||||
{
|
{
|
||||||
Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, "
|
Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, "
|
||||||
"FILENAME_VAR_NAME == ", FILENAME_VAR_NAME);
|
"FILENAME_VAR_NAME == ", FILENAME_VAR_NAME);
|
||||||
|
@ -203,7 +239,7 @@ int main()
|
||||||
Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, "
|
Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, "
|
||||||
"FILENAME_VAR_EXT is not defined.");
|
"FILENAME_VAR_EXT is not defined.");
|
||||||
#else
|
#else
|
||||||
if(strcmp(FILENAME_VAR_EXT, ".txt") != 0)
|
if(strcmp(FILENAME_VAR_EXT, ".cmake") != 0)
|
||||||
{
|
{
|
||||||
Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, "
|
Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, "
|
||||||
"FILENAME_VAR_EXT == ", FILENAME_VAR_EXT);
|
"FILENAME_VAR_EXT == ", FILENAME_VAR_EXT);
|
||||||
|
|
|
@ -11,13 +11,33 @@ SET(ONE_VAR 1)
|
||||||
VARIABLE_REQUIRES(ONE_VAR
|
VARIABLE_REQUIRES(ONE_VAR
|
||||||
ONE_VAR_IS_DEFINED ONE_VAR)
|
ONE_VAR_IS_DEFINED ONE_VAR)
|
||||||
|
|
||||||
|
SET (ONE_VAR2 1)
|
||||||
|
|
||||||
|
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(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)
|
||||||
|
|
||||||
SET(STRING_VAR "CMake is great" CACHE STRING "test a cache variable")
|
SET(STRING_VAR "CMake is great" CACHE STRING "test a cache variable")
|
||||||
|
|
||||||
|
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")
|
||||||
|
|
||||||
FOREACH (INDEX 1 2)
|
FOREACH (INDEX 1 2)
|
||||||
SET(FOREACH_VAR${INDEX} "VALUE${INDEX}")
|
SET(FOREACH_VAR${INDEX} "VALUE${INDEX}")
|
||||||
ENDFOREACH(INDEX)
|
ENDFOREACH(INDEX)
|
||||||
|
|
||||||
FIND_FILE(FILENAME_VAR "VarTests.txt" ${Complex_SOURCE_DIR})
|
FIND_FILE(FILENAME_VAR "VarTests.cmake" ${Complex_SOURCE_DIR})
|
||||||
|
|
||||||
GET_FILENAME_COMPONENT(FILENAME_VAR_PATH ${FILENAME_VAR} PATH)
|
GET_FILENAME_COMPONENT(FILENAME_VAR_PATH ${FILENAME_VAR} PATH)
|
||||||
GET_FILENAME_COMPONENT(FILENAME_VAR_PATH_NAME ${FILENAME_VAR_PATH} NAME)
|
GET_FILENAME_COMPONENT(FILENAME_VAR_PATH_NAME ${FILENAME_VAR_PATH} NAME)
|
||||||
|
@ -25,7 +45,7 @@ GET_FILENAME_COMPONENT(FILENAME_VAR_NAME ${FILENAME_VAR} NAME)
|
||||||
GET_FILENAME_COMPONENT(FILENAME_VAR_EXT ${FILENAME_VAR} EXT)
|
GET_FILENAME_COMPONENT(FILENAME_VAR_EXT ${FILENAME_VAR} EXT)
|
||||||
GET_FILENAME_COMPONENT(FILENAME_VAR_NAME_WE ${FILENAME_VAR} NAME_WE)
|
GET_FILENAME_COMPONENT(FILENAME_VAR_NAME_WE ${FILENAME_VAR} NAME_WE)
|
||||||
|
|
||||||
FIND_PATH(PATH_VAR "VarTests.txt" ${Complex_SOURCE_DIR})
|
FIND_PATH(PATH_VAR "VarTests.cmake" ${Complex_SOURCE_DIR})
|
||||||
GET_FILENAME_COMPONENT(PATH_VAR_NAME ${PATH_VAR} NAME)
|
GET_FILENAME_COMPONENT(PATH_VAR_NAME ${PATH_VAR} NAME)
|
||||||
|
|
||||||
# Coverage only
|
# Coverage only
|
Loading…
Reference in New Issue