diff options
author | Sebastien Barre <sebastien.barre@kitware.com> | 2002-01-20 05:12:27 (GMT) |
---|---|---|
committer | Sebastien Barre <sebastien.barre@kitware.com> | 2002-01-20 05:12:27 (GMT) |
commit | 049a4820a23ba3f939246f96458a281ddc8f29a2 (patch) | |
tree | d963cc29b925ef5c83b7f914f36a078fc3112147 /Tests | |
parent | df5131adc294301b08783a6bc9738afd2049d197 (diff) | |
download | CMake-049a4820a23ba3f939246f96458a281ddc8f29a2.zip CMake-049a4820a23ba3f939246f96458a281ddc8f29a2.tar.gz CMake-049a4820a23ba3f939246f96458a281ddc8f29a2.tar.bz2 |
More tests + coverage
Diffstat (limited to 'Tests')
21 files changed, 483 insertions, 246 deletions
diff --git a/Tests/Complex/CMakeCache.txt b/Tests/Complex/CMakeCache.txt index 14d9d61..17c55aa 100644 --- a/Tests/Complex/CMakeCache.txt +++ b/Tests/Complex/CMakeCache.txt @@ -21,3 +21,14 @@ CACHE_TEST_VAR2:FILEPATH=bar //A var. CACHE_TEST_VAR3:BOOL=1 + +//A var. +CACHE_TEST_VAR_EXCLUDED:BOOL=1 + + +######################## +# INTERNAL cache entries +######################## + +//A var. +CACHE_TEST_VAR_INTERNAL:INTERNAL=bar diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index e83dc9e..8bd6bcd 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -19,7 +19,11 @@ 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} + EXCLUDE + CACHE_TEST_VAR_EXCLUDED + INCLUDE_INTERNALS + CACHE_TEST_VAR_INTERNAL) # # Configure file @@ -31,13 +35,17 @@ CONFIGURE_FILE( # # Specify include and lib dirs +# (BEFORE is for coverage) # INCLUDE_DIRECTORIES( - ${Complex_BINARY_DIR} ${Complex_SOURCE_DIR}/Library ${Complex_SOURCE_DIR}/../../Source ) +INCLUDE_DIRECTORIES(BEFORE + ${Complex_BINARY_DIR} +) + INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$") LINK_DIRECTORIES( @@ -65,6 +73,7 @@ SUBDIR_DEPENDS(Executable Library) # Exec program (TODO: test a result) # Increase coverage. # +MESSAGE("Trying to increase coverage...") OPTION(NO_EXEC_PROGRAM "Do not test EXEC_PROGRAM" 0) IF (NOT NO_EXEC_PROGRAM) EXEC_PROGRAM("echo NO_EXEC_PROGRAM" "${Complex_BINARY_DIR}") diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt index 26d3df5..33332eb 100644 --- a/Tests/Complex/Executable/CMakeLists.txt +++ b/Tests/Complex/Executable/CMakeLists.txt @@ -20,9 +20,18 @@ FIND_LIBRARY(CMAKE_LIB TARGET_LINK_LIBRARIES(complex ${CMAKE_LIB}) # +# Output the files required by 'complex' to a file. +# The 'complex' executable will then test if this file exists and remove it. +# The contents of this file is not tested (absolute paths). +# +#OUTPUT_REQUIRED_FILES(${Complex_SOURCE_DIR}/Executable/complex.cxx +# ${Complex_BINARY_DIR}/Executable/complex-required.txt) + +# # Extra coverage.Not used. # INSTALL_TARGETS(/tmp complex) INSTALL_PROGRAMS(/tmp complex) SOURCE_GROUP(A_GROUP ".cxx") + diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx index 21576e9..a611b72 100644 --- a/Tests/Complex/Executable/complex.cxx +++ b/Tests/Complex/Executable/complex.cxx @@ -5,23 +5,23 @@ #include "cmStandardIncludes.h" #include "cmSystemTools.h" -int passed = 0; -int failed = 0; +int cm_passed = 0; +int cm_failed = 0; // ====================================================================== -void Failed(const char* Message, const char* m2= "") +void cmFailed(const char* Message, const char* m2= "") { std::cerr << "Failed: " << Message << m2 << "\n"; - failed++; + cm_failed++; } // ====================================================================== -void Passed(const char* Message, const char* m2="") +void cmPassed(const char* Message, const char* m2="") { std::cout << "Passed: " << Message << m2 << "\n"; - passed++; + cm_passed++; } // ====================================================================== @@ -30,17 +30,17 @@ void TestAndRemoveFile(const char* filename) { if (!cmSystemTools::FileExists(filename)) { - Failed("Could not find file: ", filename); + cmFailed("Could not find file: ", filename); } else { if (!cmSystemTools::RemoveFile(filename)) { - Failed("Unable to remove file. It does not imply that this test failed, but it *will* be corrupted thereafter if this file is not removed: ", filename); + cmFailed("Unable to remove file. It does not imply that this test failed, but it *will* be corrupted thereafter if this file is not removed: ", filename); } else { - Passed("Find and remove file: ", filename); + cmPassed("Find and remove file: ", filename); } } } @@ -51,17 +51,17 @@ void TestDir(const char* filename) { if (!cmSystemTools::FileExists(filename)) { - Failed("Could not find dir: ", filename); + cmFailed("Could not find dir: ", filename); } else { if (!cmSystemTools::FileIsDirectory(filename)) { - Failed("Unable to check if file is a directory: ", filename); + cmFailed("Unable to check if file is a directory: ", filename); } else { - Passed("Find dir: ", filename); + cmPassed("Find dir: ", filename); } } } @@ -72,85 +72,85 @@ int main() { if(sharedFunction() != 1) { - Failed("Call to sharedFunction from shared library failed."); + cmFailed("Call to sharedFunction from shared library failed."); } else { - Passed("Call to sharedFunction from shared library worked."); + cmPassed("Call to sharedFunction from shared library worked."); } if(file1() != 1) { - Failed("Call to file1 function from library failed."); + cmFailed("Call to file1 function from library failed."); } else { - Passed("Call to file1 function returned 1."); + cmPassed("Call to file1 function returned 1."); } if(file2() != 1) { - Failed("Call to file2 function from library failed."); + cmFailed("Call to file2 function from library failed."); } else { - Passed("Call to file2 function returned 1."); + cmPassed("Call to file2 function returned 1."); } // ---------------------------------------------------------------------- // Test ADD_DEFINITIONS #ifndef CMAKE_IS_FUN - Failed("CMake is not fun, so it is broken and should be fixed."); + cmFailed("CMake is not fun, so it is broken and should be fixed."); #else - Passed("CMAKE_IS_FUN is defined."); + cmPassed("CMAKE_IS_FUN is defined."); #endif // ---------------------------------------------------------------------- // Test SET, VARIABLE_REQUIRES #ifdef SHOULD_NOT_BE_DEFINED - Failed("IF or SET is broken, SHOULD_NOT_BE_DEFINED is defined."); + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED is defined."); #else - Passed("SHOULD_NOT_BE_DEFINED is not defined."); + cmPassed("SHOULD_NOT_BE_DEFINED is not defined."); #endif #ifndef SHOULD_BE_DEFINED - Failed("IF or SET is broken, SHOULD_BE_DEFINED is not defined.\n"); + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED is not defined.\n"); #else - Passed("SHOULD_BE_DEFINED is defined."); + cmPassed("SHOULD_BE_DEFINED is defined."); #endif #ifndef ONE_VAR - Failed("cmakedefine is broken, ONE_VAR is not defined."); + cmFailed("cmakedefine is broken, ONE_VAR is not defined."); #else - Passed("ONE_VAR is defined."); + cmPassed("ONE_VAR is defined."); #endif #ifndef ONE_VAR_IS_DEFINED - Failed("cmakedefine, SET or VARIABLE_REQUIRES is broken, " + cmFailed("cmakedefine, SET or VARIABLE_REQUIRES is broken, " "ONE_VAR_IS_DEFINED is not defined."); #else - Passed("ONE_VAR_IS_DEFINED is defined."); + cmPassed("ONE_VAR_IS_DEFINED is defined."); #endif #ifdef ZERO_VAR - Failed("cmakedefine is broken, ZERO_VAR is defined."); + cmFailed("cmakedefine is broken, ZERO_VAR is defined."); #else - Passed("ZERO_VAR is not defined."); + cmPassed("ZERO_VAR is not defined."); #endif #ifndef STRING_VAR - Failed("the CONFIGURE_FILE command is broken, STRING_VAR is not defined."); + cmFailed("the CONFIGURE_FILE command is broken, STRING_VAR is not defined."); #else if(strcmp(STRING_VAR, "CMake is great") != 0) { - Failed("the SET or CONFIGURE_FILE command is broken. STRING_VAR == ", + cmFailed("the SET or CONFIGURE_FILE command is broken. STRING_VAR == ", STRING_VAR); } else { - Passed("STRING_VAR == ", STRING_VAR); + cmPassed("STRING_VAR == ", STRING_VAR); } #endif @@ -158,71 +158,83 @@ int main() // Test various IF/ELSE combinations #ifdef SHOULD_NOT_BE_DEFINED_AND - Failed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND is defined."); + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND is defined."); #else - Passed("SHOULD_NOT_BE_DEFINED_AND is not defined."); + cmPassed("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"); + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_AND is not defined.\n"); #else - Passed("SHOULD_BE_DEFINED_AND is defined."); + cmPassed("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."); + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR is defined."); #else - Passed("SHOULD_NOT_BE_DEFINED_OR is not defined."); + cmPassed("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"); + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_OR is not defined.\n"); #else - Passed("SHOULD_BE_DEFINED_OR is defined."); + cmPassed("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."); + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES is defined."); #else - Passed("SHOULD_NOT_BE_DEFINED_MATCHES is not defined."); + cmPassed("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"); + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_MATCHES is not defined.\n"); #else - Passed("SHOULD_BE_DEFINED_MATCHES is defined."); + cmPassed("SHOULD_BE_DEFINED_MATCHES is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_COMMAND + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_COMMAND is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_COMMAND is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_COMMAND + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_COMMAND is not defined.\n"); +#else + cmPassed("SHOULD_BE_DEFINED_COMMAND is defined."); #endif // ---------------------------------------------------------------------- // Test FOREACH #ifndef FOREACH_VAR1 - Failed("the FOREACH, SET or CONFIGURE_FILE command is broken, " + cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, " "FOREACH_VAR1 is not defined."); #else if(strcmp(FOREACH_VAR1, "VALUE1") != 0) { - Failed("the FOREACH, SET or CONFIGURE_FILE command is broken, " + cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, " "FOREACH_VAR1 == ", FOREACH_VAR1); } else { - Passed("FOREACH_VAR1 == ", FOREACH_VAR1); + cmPassed("FOREACH_VAR1 == ", FOREACH_VAR1); } #endif #ifndef FOREACH_VAR2 - Failed("the FOREACH, SET or CONFIGURE_FILE command is broken, " + cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, " "FOREACH_VAR2 is not defined."); #else if(strcmp(FOREACH_VAR2, "VALUE2") != 0) { - Failed("the FOREACH, SET or CONFIGURE_FILE command is broken, " + cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, " "FOREACH_VAR2 == ", FOREACH_VAR2); } else { - Passed("FOREACH_VAR2 == ", FOREACH_VAR2); + cmPassed("FOREACH_VAR2 == ", FOREACH_VAR2); } #endif @@ -230,77 +242,77 @@ int main() // Test FIND_FILE, FIND_PATH and various GET_FILENAME_COMPONENT combinations #ifndef FILENAME_VAR_PATH_NAME - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "FILENAME_VAR_PATH_NAME is not defined."); #else if(strcmp(FILENAME_VAR_PATH_NAME, "Complex") != 0) { - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "FILENAME_VAR_PATH_NAME == ", FILENAME_VAR_PATH_NAME); } else { - Passed("FILENAME_VAR_PATH_NAME == ", FILENAME_VAR_PATH_NAME); + cmPassed("FILENAME_VAR_PATH_NAME == ", FILENAME_VAR_PATH_NAME); } #endif #ifndef FILENAME_VAR_NAME - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "FILENAME_VAR_NAME is not defined."); #else if(strcmp(FILENAME_VAR_NAME, "VarTests.cmake") != 0) { - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "FILENAME_VAR_NAME == ", FILENAME_VAR_NAME); } else { - Passed("FILENAME_VAR_NAME == ", FILENAME_VAR_NAME); + cmPassed("FILENAME_VAR_NAME == ", FILENAME_VAR_NAME); } #endif #ifndef FILENAME_VAR_EXT - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "FILENAME_VAR_EXT is not defined."); #else if(strcmp(FILENAME_VAR_EXT, ".cmake") != 0) { - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "FILENAME_VAR_EXT == ", FILENAME_VAR_EXT); } else { - Passed("FILENAME_VAR_EXT == ", FILENAME_VAR_EXT); + cmPassed("FILENAME_VAR_EXT == ", FILENAME_VAR_EXT); } #endif #ifndef FILENAME_VAR_NAME_WE - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "FILENAME_VAR_NAME_WE is not defined."); #else if(strcmp(FILENAME_VAR_NAME_WE, "VarTests") != 0) { - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "FILENAME_VAR_NAME_WE == ", FILENAME_VAR_NAME_WE); } else { - Passed("FILENAME_VAR_NAME_WE == ", FILENAME_VAR_NAME_WE); + cmPassed("FILENAME_VAR_NAME_WE == ", FILENAME_VAR_NAME_WE); } #endif #ifndef PATH_VAR_NAME - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "PATH_VAR_NAME is not defined."); #else if(strcmp(PATH_VAR_NAME, "Complex") != 0) { - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "PATH_VAR_NAME == ", PATH_VAR_NAME); } else { - Passed("PATH_VAR_NAME == ", PATH_VAR_NAME); + cmPassed("PATH_VAR_NAME == ", PATH_VAR_NAME); } #endif @@ -308,47 +320,69 @@ int main() // Test LOAD_CACHE #ifndef CACHE_TEST_VAR1 - Failed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " "CACHE_TEST_VAR1 is not defined."); #else if(strcmp(CACHE_TEST_VAR1, "foo") != 0) { - Failed("the FOREACH, SET or CONFIGURE_FILE command is broken, " + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " "CACHE_TEST_VAR1 == ", CACHE_TEST_VAR1); } else { - Passed("CACHE_TEST_VAR1 == ", CACHE_TEST_VAR1); + cmPassed("CACHE_TEST_VAR1 == ", CACHE_TEST_VAR1); } #endif #ifndef CACHE_TEST_VAR2 - Failed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " "CACHE_TEST_VAR2 is not defined."); #else if(strcmp(CACHE_TEST_VAR2, "bar") != 0) { - Failed("the FOREACH, SET or CONFIGURE_FILE command is broken, " + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " "CACHE_TEST_VAR2 == ", CACHE_TEST_VAR2); } else { - Passed("CACHE_TEST_VAR2 == ", CACHE_TEST_VAR2); + cmPassed("CACHE_TEST_VAR2 == ", CACHE_TEST_VAR2); } #endif #ifndef CACHE_TEST_VAR3 - Failed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " "CACHE_TEST_VAR3 is not defined."); #else if(strcmp(CACHE_TEST_VAR3, "1") != 0) { - Failed("the FOREACH, SET or CONFIGURE_FILE command is broken, " + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " "CACHE_TEST_VAR3 == ", CACHE_TEST_VAR3); } else { - Passed("CACHE_TEST_VAR3 == ", CACHE_TEST_VAR3); + cmPassed("CACHE_TEST_VAR3 == ", CACHE_TEST_VAR3); + } +#endif + +#ifdef CACHE_TEST_VAR_EXCLUDED + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command or cmakedefine is broken, " + "CACHE_TEST_VAR_EXCLUDED is defined (should not have been loaded)."); +#else + cmPassed("CACHE_TEST_VAR_EXCLUDED is not defined."); +#endif + +#ifndef CACHE_TEST_VAR_INTERNAL + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " + "CACHE_TEST_VAR_INTERNAL is not defined."); +#else + if(strcmp(CACHE_TEST_VAR_INTERNAL, "bar") != 0) + { + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " + "CACHE_TEST_VAR_INTERNAL == ", CACHE_TEST_VAR_INTERNAL); + } + else + { + cmPassed("CACHE_TEST_VAR_INTERNAL == ", CACHE_TEST_VAR_INTERNAL); } #endif @@ -370,13 +404,20 @@ int main() TestDir(BINARY_DIR "/make_dir"); // ---------------------------------------------------------------------- + // Test OUTPUT_REQUIRED_FILES + // The files required by 'complex' have been output to a file. + // The contents of this file is not tested (absolute paths). + + TestAndRemoveFile(BINARY_DIR "/Executable/complex-required.txt"); + + // ---------------------------------------------------------------------- // Summary - std::cout << "Passed: " << passed << "\n"; - if(failed) + std::cout << "Passed: " << cm_passed << "\n"; + if(cm_failed) { - std::cout << "Failed: " << failed << "\n"; - return failed; + std::cout << "Failed: " << cm_failed << "\n"; + return cm_failed; } return 0; diff --git a/Tests/Complex/Library/CMakeLists.txt b/Tests/Complex/Library/CMakeLists.txt index 1141555..aaa11ca 100644 --- a/Tests/Complex/Library/CMakeLists.txt +++ b/Tests/Complex/Library/CMakeLists.txt @@ -54,4 +54,5 @@ ABSTRACT_FILES( ) INSTALL_FILES(/tmp .h ${Complex_BINARY_DIR}/cmTestConfigure.h) +INSTALL_FILES(/tmp .cxx ${Complex_BINARY_DIR}/cmTestConfigure.h) diff --git a/Tests/Complex/VarTests.cmake b/Tests/Complex/VarTests.cmake index 1b6c337..e4fb156 100644 --- a/Tests/Complex/VarTests.cmake +++ b/Tests/Complex/VarTests.cmake @@ -40,6 +40,12 @@ ELSE(STRING_VAR MATCHES "^CMake") ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_MATCHES) ENDIF(STRING_VAR MATCHES "^CMake") +IF(COMMAND "IF") + ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_COMMAND) +ELSE(COMMAND "IF") + ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_COMMAND) +ENDIF(COMMAND "IF") + # # Test FOREACH # @@ -58,5 +64,5 @@ GET_FILENAME_COMPONENT(FILENAME_VAR_NAME ${FILENAME_VAR} NAME) GET_FILENAME_COMPONENT(FILENAME_VAR_EXT ${FILENAME_VAR} EXT) GET_FILENAME_COMPONENT(FILENAME_VAR_NAME_WE ${FILENAME_VAR} NAME_WE CACHE) -FIND_PATH(PATH_VAR "VarTests.cmake" ${Complex_SOURCE_DIR}) +FIND_PATH(PATH_VAR "cmTestConfigure.h.in" ${Complex_SOURCE_DIR}) GET_FILENAME_COMPONENT(PATH_VAR_NAME ${PATH_VAR} NAME) diff --git a/Tests/Complex/cmTestConfigure.h.in b/Tests/Complex/cmTestConfigure.h.in index bd4f9a3..2ea6388 100644 --- a/Tests/Complex/cmTestConfigure.h.in +++ b/Tests/Complex/cmTestConfigure.h.in @@ -25,6 +25,8 @@ #define CACHE_TEST_VAR1 "${CACHE_TEST_VAR1}" #define CACHE_TEST_VAR2 "${CACHE_TEST_VAR2}" #define CACHE_TEST_VAR3 "${CACHE_TEST_VAR3}" +#cmakedefine CACHE_TEST_VAR_EXCLUDED +#define CACHE_TEST_VAR_INTERNAL "${CACHE_TEST_VAR_INTERNAL}" // Test internal CMake vars from C++ flags diff --git a/Tests/ComplexOneConfig/CMakeCache.txt b/Tests/ComplexOneConfig/CMakeCache.txt index 14d9d61..17c55aa 100644 --- a/Tests/ComplexOneConfig/CMakeCache.txt +++ b/Tests/ComplexOneConfig/CMakeCache.txt @@ -21,3 +21,14 @@ CACHE_TEST_VAR2:FILEPATH=bar //A var. CACHE_TEST_VAR3:BOOL=1 + +//A var. +CACHE_TEST_VAR_EXCLUDED:BOOL=1 + + +######################## +# INTERNAL cache entries +######################## + +//A var. +CACHE_TEST_VAR_INTERNAL:INTERNAL=bar diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index e83dc9e..8bd6bcd 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -19,7 +19,11 @@ 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} + EXCLUDE + CACHE_TEST_VAR_EXCLUDED + INCLUDE_INTERNALS + CACHE_TEST_VAR_INTERNAL) # # Configure file @@ -31,13 +35,17 @@ CONFIGURE_FILE( # # Specify include and lib dirs +# (BEFORE is for coverage) # INCLUDE_DIRECTORIES( - ${Complex_BINARY_DIR} ${Complex_SOURCE_DIR}/Library ${Complex_SOURCE_DIR}/../../Source ) +INCLUDE_DIRECTORIES(BEFORE + ${Complex_BINARY_DIR} +) + INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$") LINK_DIRECTORIES( @@ -65,6 +73,7 @@ SUBDIR_DEPENDS(Executable Library) # Exec program (TODO: test a result) # Increase coverage. # +MESSAGE("Trying to increase coverage...") OPTION(NO_EXEC_PROGRAM "Do not test EXEC_PROGRAM" 0) IF (NOT NO_EXEC_PROGRAM) EXEC_PROGRAM("echo NO_EXEC_PROGRAM" "${Complex_BINARY_DIR}") diff --git a/Tests/ComplexOneConfig/Executable/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/CMakeLists.txt index 26d3df5..33332eb 100644 --- a/Tests/ComplexOneConfig/Executable/CMakeLists.txt +++ b/Tests/ComplexOneConfig/Executable/CMakeLists.txt @@ -20,9 +20,18 @@ FIND_LIBRARY(CMAKE_LIB TARGET_LINK_LIBRARIES(complex ${CMAKE_LIB}) # +# Output the files required by 'complex' to a file. +# The 'complex' executable will then test if this file exists and remove it. +# The contents of this file is not tested (absolute paths). +# +#OUTPUT_REQUIRED_FILES(${Complex_SOURCE_DIR}/Executable/complex.cxx +# ${Complex_BINARY_DIR}/Executable/complex-required.txt) + +# # Extra coverage.Not used. # INSTALL_TARGETS(/tmp complex) INSTALL_PROGRAMS(/tmp complex) SOURCE_GROUP(A_GROUP ".cxx") + diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx index 21576e9..a611b72 100644 --- a/Tests/ComplexOneConfig/Executable/complex.cxx +++ b/Tests/ComplexOneConfig/Executable/complex.cxx @@ -5,23 +5,23 @@ #include "cmStandardIncludes.h" #include "cmSystemTools.h" -int passed = 0; -int failed = 0; +int cm_passed = 0; +int cm_failed = 0; // ====================================================================== -void Failed(const char* Message, const char* m2= "") +void cmFailed(const char* Message, const char* m2= "") { std::cerr << "Failed: " << Message << m2 << "\n"; - failed++; + cm_failed++; } // ====================================================================== -void Passed(const char* Message, const char* m2="") +void cmPassed(const char* Message, const char* m2="") { std::cout << "Passed: " << Message << m2 << "\n"; - passed++; + cm_passed++; } // ====================================================================== @@ -30,17 +30,17 @@ void TestAndRemoveFile(const char* filename) { if (!cmSystemTools::FileExists(filename)) { - Failed("Could not find file: ", filename); + cmFailed("Could not find file: ", filename); } else { if (!cmSystemTools::RemoveFile(filename)) { - Failed("Unable to remove file. It does not imply that this test failed, but it *will* be corrupted thereafter if this file is not removed: ", filename); + cmFailed("Unable to remove file. It does not imply that this test failed, but it *will* be corrupted thereafter if this file is not removed: ", filename); } else { - Passed("Find and remove file: ", filename); + cmPassed("Find and remove file: ", filename); } } } @@ -51,17 +51,17 @@ void TestDir(const char* filename) { if (!cmSystemTools::FileExists(filename)) { - Failed("Could not find dir: ", filename); + cmFailed("Could not find dir: ", filename); } else { if (!cmSystemTools::FileIsDirectory(filename)) { - Failed("Unable to check if file is a directory: ", filename); + cmFailed("Unable to check if file is a directory: ", filename); } else { - Passed("Find dir: ", filename); + cmPassed("Find dir: ", filename); } } } @@ -72,85 +72,85 @@ int main() { if(sharedFunction() != 1) { - Failed("Call to sharedFunction from shared library failed."); + cmFailed("Call to sharedFunction from shared library failed."); } else { - Passed("Call to sharedFunction from shared library worked."); + cmPassed("Call to sharedFunction from shared library worked."); } if(file1() != 1) { - Failed("Call to file1 function from library failed."); + cmFailed("Call to file1 function from library failed."); } else { - Passed("Call to file1 function returned 1."); + cmPassed("Call to file1 function returned 1."); } if(file2() != 1) { - Failed("Call to file2 function from library failed."); + cmFailed("Call to file2 function from library failed."); } else { - Passed("Call to file2 function returned 1."); + cmPassed("Call to file2 function returned 1."); } // ---------------------------------------------------------------------- // Test ADD_DEFINITIONS #ifndef CMAKE_IS_FUN - Failed("CMake is not fun, so it is broken and should be fixed."); + cmFailed("CMake is not fun, so it is broken and should be fixed."); #else - Passed("CMAKE_IS_FUN is defined."); + cmPassed("CMAKE_IS_FUN is defined."); #endif // ---------------------------------------------------------------------- // Test SET, VARIABLE_REQUIRES #ifdef SHOULD_NOT_BE_DEFINED - Failed("IF or SET is broken, SHOULD_NOT_BE_DEFINED is defined."); + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED is defined."); #else - Passed("SHOULD_NOT_BE_DEFINED is not defined."); + cmPassed("SHOULD_NOT_BE_DEFINED is not defined."); #endif #ifndef SHOULD_BE_DEFINED - Failed("IF or SET is broken, SHOULD_BE_DEFINED is not defined.\n"); + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED is not defined.\n"); #else - Passed("SHOULD_BE_DEFINED is defined."); + cmPassed("SHOULD_BE_DEFINED is defined."); #endif #ifndef ONE_VAR - Failed("cmakedefine is broken, ONE_VAR is not defined."); + cmFailed("cmakedefine is broken, ONE_VAR is not defined."); #else - Passed("ONE_VAR is defined."); + cmPassed("ONE_VAR is defined."); #endif #ifndef ONE_VAR_IS_DEFINED - Failed("cmakedefine, SET or VARIABLE_REQUIRES is broken, " + cmFailed("cmakedefine, SET or VARIABLE_REQUIRES is broken, " "ONE_VAR_IS_DEFINED is not defined."); #else - Passed("ONE_VAR_IS_DEFINED is defined."); + cmPassed("ONE_VAR_IS_DEFINED is defined."); #endif #ifdef ZERO_VAR - Failed("cmakedefine is broken, ZERO_VAR is defined."); + cmFailed("cmakedefine is broken, ZERO_VAR is defined."); #else - Passed("ZERO_VAR is not defined."); + cmPassed("ZERO_VAR is not defined."); #endif #ifndef STRING_VAR - Failed("the CONFIGURE_FILE command is broken, STRING_VAR is not defined."); + cmFailed("the CONFIGURE_FILE command is broken, STRING_VAR is not defined."); #else if(strcmp(STRING_VAR, "CMake is great") != 0) { - Failed("the SET or CONFIGURE_FILE command is broken. STRING_VAR == ", + cmFailed("the SET or CONFIGURE_FILE command is broken. STRING_VAR == ", STRING_VAR); } else { - Passed("STRING_VAR == ", STRING_VAR); + cmPassed("STRING_VAR == ", STRING_VAR); } #endif @@ -158,71 +158,83 @@ int main() // Test various IF/ELSE combinations #ifdef SHOULD_NOT_BE_DEFINED_AND - Failed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND is defined."); + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND is defined."); #else - Passed("SHOULD_NOT_BE_DEFINED_AND is not defined."); + cmPassed("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"); + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_AND is not defined.\n"); #else - Passed("SHOULD_BE_DEFINED_AND is defined."); + cmPassed("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."); + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR is defined."); #else - Passed("SHOULD_NOT_BE_DEFINED_OR is not defined."); + cmPassed("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"); + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_OR is not defined.\n"); #else - Passed("SHOULD_BE_DEFINED_OR is defined."); + cmPassed("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."); + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES is defined."); #else - Passed("SHOULD_NOT_BE_DEFINED_MATCHES is not defined."); + cmPassed("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"); + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_MATCHES is not defined.\n"); #else - Passed("SHOULD_BE_DEFINED_MATCHES is defined."); + cmPassed("SHOULD_BE_DEFINED_MATCHES is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_COMMAND + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_COMMAND is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_COMMAND is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_COMMAND + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_COMMAND is not defined.\n"); +#else + cmPassed("SHOULD_BE_DEFINED_COMMAND is defined."); #endif // ---------------------------------------------------------------------- // Test FOREACH #ifndef FOREACH_VAR1 - Failed("the FOREACH, SET or CONFIGURE_FILE command is broken, " + cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, " "FOREACH_VAR1 is not defined."); #else if(strcmp(FOREACH_VAR1, "VALUE1") != 0) { - Failed("the FOREACH, SET or CONFIGURE_FILE command is broken, " + cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, " "FOREACH_VAR1 == ", FOREACH_VAR1); } else { - Passed("FOREACH_VAR1 == ", FOREACH_VAR1); + cmPassed("FOREACH_VAR1 == ", FOREACH_VAR1); } #endif #ifndef FOREACH_VAR2 - Failed("the FOREACH, SET or CONFIGURE_FILE command is broken, " + cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, " "FOREACH_VAR2 is not defined."); #else if(strcmp(FOREACH_VAR2, "VALUE2") != 0) { - Failed("the FOREACH, SET or CONFIGURE_FILE command is broken, " + cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, " "FOREACH_VAR2 == ", FOREACH_VAR2); } else { - Passed("FOREACH_VAR2 == ", FOREACH_VAR2); + cmPassed("FOREACH_VAR2 == ", FOREACH_VAR2); } #endif @@ -230,77 +242,77 @@ int main() // Test FIND_FILE, FIND_PATH and various GET_FILENAME_COMPONENT combinations #ifndef FILENAME_VAR_PATH_NAME - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "FILENAME_VAR_PATH_NAME is not defined."); #else if(strcmp(FILENAME_VAR_PATH_NAME, "Complex") != 0) { - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "FILENAME_VAR_PATH_NAME == ", FILENAME_VAR_PATH_NAME); } else { - Passed("FILENAME_VAR_PATH_NAME == ", FILENAME_VAR_PATH_NAME); + cmPassed("FILENAME_VAR_PATH_NAME == ", FILENAME_VAR_PATH_NAME); } #endif #ifndef FILENAME_VAR_NAME - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "FILENAME_VAR_NAME is not defined."); #else if(strcmp(FILENAME_VAR_NAME, "VarTests.cmake") != 0) { - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "FILENAME_VAR_NAME == ", FILENAME_VAR_NAME); } else { - Passed("FILENAME_VAR_NAME == ", FILENAME_VAR_NAME); + cmPassed("FILENAME_VAR_NAME == ", FILENAME_VAR_NAME); } #endif #ifndef FILENAME_VAR_EXT - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "FILENAME_VAR_EXT is not defined."); #else if(strcmp(FILENAME_VAR_EXT, ".cmake") != 0) { - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "FILENAME_VAR_EXT == ", FILENAME_VAR_EXT); } else { - Passed("FILENAME_VAR_EXT == ", FILENAME_VAR_EXT); + cmPassed("FILENAME_VAR_EXT == ", FILENAME_VAR_EXT); } #endif #ifndef FILENAME_VAR_NAME_WE - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "FILENAME_VAR_NAME_WE is not defined."); #else if(strcmp(FILENAME_VAR_NAME_WE, "VarTests") != 0) { - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "FILENAME_VAR_NAME_WE == ", FILENAME_VAR_NAME_WE); } else { - Passed("FILENAME_VAR_NAME_WE == ", FILENAME_VAR_NAME_WE); + cmPassed("FILENAME_VAR_NAME_WE == ", FILENAME_VAR_NAME_WE); } #endif #ifndef PATH_VAR_NAME - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "PATH_VAR_NAME is not defined."); #else if(strcmp(PATH_VAR_NAME, "Complex") != 0) { - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "PATH_VAR_NAME == ", PATH_VAR_NAME); } else { - Passed("PATH_VAR_NAME == ", PATH_VAR_NAME); + cmPassed("PATH_VAR_NAME == ", PATH_VAR_NAME); } #endif @@ -308,47 +320,69 @@ int main() // Test LOAD_CACHE #ifndef CACHE_TEST_VAR1 - Failed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " "CACHE_TEST_VAR1 is not defined."); #else if(strcmp(CACHE_TEST_VAR1, "foo") != 0) { - Failed("the FOREACH, SET or CONFIGURE_FILE command is broken, " + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " "CACHE_TEST_VAR1 == ", CACHE_TEST_VAR1); } else { - Passed("CACHE_TEST_VAR1 == ", CACHE_TEST_VAR1); + cmPassed("CACHE_TEST_VAR1 == ", CACHE_TEST_VAR1); } #endif #ifndef CACHE_TEST_VAR2 - Failed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " "CACHE_TEST_VAR2 is not defined."); #else if(strcmp(CACHE_TEST_VAR2, "bar") != 0) { - Failed("the FOREACH, SET or CONFIGURE_FILE command is broken, " + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " "CACHE_TEST_VAR2 == ", CACHE_TEST_VAR2); } else { - Passed("CACHE_TEST_VAR2 == ", CACHE_TEST_VAR2); + cmPassed("CACHE_TEST_VAR2 == ", CACHE_TEST_VAR2); } #endif #ifndef CACHE_TEST_VAR3 - Failed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " "CACHE_TEST_VAR3 is not defined."); #else if(strcmp(CACHE_TEST_VAR3, "1") != 0) { - Failed("the FOREACH, SET or CONFIGURE_FILE command is broken, " + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " "CACHE_TEST_VAR3 == ", CACHE_TEST_VAR3); } else { - Passed("CACHE_TEST_VAR3 == ", CACHE_TEST_VAR3); + cmPassed("CACHE_TEST_VAR3 == ", CACHE_TEST_VAR3); + } +#endif + +#ifdef CACHE_TEST_VAR_EXCLUDED + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command or cmakedefine is broken, " + "CACHE_TEST_VAR_EXCLUDED is defined (should not have been loaded)."); +#else + cmPassed("CACHE_TEST_VAR_EXCLUDED is not defined."); +#endif + +#ifndef CACHE_TEST_VAR_INTERNAL + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " + "CACHE_TEST_VAR_INTERNAL is not defined."); +#else + if(strcmp(CACHE_TEST_VAR_INTERNAL, "bar") != 0) + { + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " + "CACHE_TEST_VAR_INTERNAL == ", CACHE_TEST_VAR_INTERNAL); + } + else + { + cmPassed("CACHE_TEST_VAR_INTERNAL == ", CACHE_TEST_VAR_INTERNAL); } #endif @@ -370,13 +404,20 @@ int main() TestDir(BINARY_DIR "/make_dir"); // ---------------------------------------------------------------------- + // Test OUTPUT_REQUIRED_FILES + // The files required by 'complex' have been output to a file. + // The contents of this file is not tested (absolute paths). + + TestAndRemoveFile(BINARY_DIR "/Executable/complex-required.txt"); + + // ---------------------------------------------------------------------- // Summary - std::cout << "Passed: " << passed << "\n"; - if(failed) + std::cout << "Passed: " << cm_passed << "\n"; + if(cm_failed) { - std::cout << "Failed: " << failed << "\n"; - return failed; + std::cout << "Failed: " << cm_failed << "\n"; + return cm_failed; } return 0; diff --git a/Tests/ComplexOneConfig/Library/CMakeLists.txt b/Tests/ComplexOneConfig/Library/CMakeLists.txt index 1141555..aaa11ca 100644 --- a/Tests/ComplexOneConfig/Library/CMakeLists.txt +++ b/Tests/ComplexOneConfig/Library/CMakeLists.txt @@ -54,4 +54,5 @@ ABSTRACT_FILES( ) INSTALL_FILES(/tmp .h ${Complex_BINARY_DIR}/cmTestConfigure.h) +INSTALL_FILES(/tmp .cxx ${Complex_BINARY_DIR}/cmTestConfigure.h) diff --git a/Tests/ComplexOneConfig/VarTests.cmake b/Tests/ComplexOneConfig/VarTests.cmake index 1b6c337..e4fb156 100644 --- a/Tests/ComplexOneConfig/VarTests.cmake +++ b/Tests/ComplexOneConfig/VarTests.cmake @@ -40,6 +40,12 @@ ELSE(STRING_VAR MATCHES "^CMake") ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_MATCHES) ENDIF(STRING_VAR MATCHES "^CMake") +IF(COMMAND "IF") + ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_COMMAND) +ELSE(COMMAND "IF") + ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_COMMAND) +ENDIF(COMMAND "IF") + # # Test FOREACH # @@ -58,5 +64,5 @@ GET_FILENAME_COMPONENT(FILENAME_VAR_NAME ${FILENAME_VAR} NAME) GET_FILENAME_COMPONENT(FILENAME_VAR_EXT ${FILENAME_VAR} EXT) GET_FILENAME_COMPONENT(FILENAME_VAR_NAME_WE ${FILENAME_VAR} NAME_WE CACHE) -FIND_PATH(PATH_VAR "VarTests.cmake" ${Complex_SOURCE_DIR}) +FIND_PATH(PATH_VAR "cmTestConfigure.h.in" ${Complex_SOURCE_DIR}) GET_FILENAME_COMPONENT(PATH_VAR_NAME ${PATH_VAR} NAME) diff --git a/Tests/ComplexOneConfig/cmTestConfigure.h.in b/Tests/ComplexOneConfig/cmTestConfigure.h.in index bd4f9a3..2ea6388 100644 --- a/Tests/ComplexOneConfig/cmTestConfigure.h.in +++ b/Tests/ComplexOneConfig/cmTestConfigure.h.in @@ -25,6 +25,8 @@ #define CACHE_TEST_VAR1 "${CACHE_TEST_VAR1}" #define CACHE_TEST_VAR2 "${CACHE_TEST_VAR2}" #define CACHE_TEST_VAR3 "${CACHE_TEST_VAR3}" +#cmakedefine CACHE_TEST_VAR_EXCLUDED +#define CACHE_TEST_VAR_INTERNAL "${CACHE_TEST_VAR_INTERNAL}" // Test internal CMake vars from C++ flags diff --git a/Tests/ComplexRelativePaths/CMakeCache.txt b/Tests/ComplexRelativePaths/CMakeCache.txt index 14d9d61..17c55aa 100644 --- a/Tests/ComplexRelativePaths/CMakeCache.txt +++ b/Tests/ComplexRelativePaths/CMakeCache.txt @@ -21,3 +21,14 @@ CACHE_TEST_VAR2:FILEPATH=bar //A var. CACHE_TEST_VAR3:BOOL=1 + +//A var. +CACHE_TEST_VAR_EXCLUDED:BOOL=1 + + +######################## +# INTERNAL cache entries +######################## + +//A var. +CACHE_TEST_VAR_INTERNAL:INTERNAL=bar diff --git a/Tests/ComplexRelativePaths/CMakeLists.txt b/Tests/ComplexRelativePaths/CMakeLists.txt index e83dc9e..8bd6bcd 100644 --- a/Tests/ComplexRelativePaths/CMakeLists.txt +++ b/Tests/ComplexRelativePaths/CMakeLists.txt @@ -19,7 +19,11 @@ 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} + EXCLUDE + CACHE_TEST_VAR_EXCLUDED + INCLUDE_INTERNALS + CACHE_TEST_VAR_INTERNAL) # # Configure file @@ -31,13 +35,17 @@ CONFIGURE_FILE( # # Specify include and lib dirs +# (BEFORE is for coverage) # INCLUDE_DIRECTORIES( - ${Complex_BINARY_DIR} ${Complex_SOURCE_DIR}/Library ${Complex_SOURCE_DIR}/../../Source ) +INCLUDE_DIRECTORIES(BEFORE + ${Complex_BINARY_DIR} +) + INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$") LINK_DIRECTORIES( @@ -65,6 +73,7 @@ SUBDIR_DEPENDS(Executable Library) # Exec program (TODO: test a result) # Increase coverage. # +MESSAGE("Trying to increase coverage...") OPTION(NO_EXEC_PROGRAM "Do not test EXEC_PROGRAM" 0) IF (NOT NO_EXEC_PROGRAM) EXEC_PROGRAM("echo NO_EXEC_PROGRAM" "${Complex_BINARY_DIR}") diff --git a/Tests/ComplexRelativePaths/Executable/CMakeLists.txt b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt index 26d3df5..33332eb 100644 --- a/Tests/ComplexRelativePaths/Executable/CMakeLists.txt +++ b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt @@ -20,9 +20,18 @@ FIND_LIBRARY(CMAKE_LIB TARGET_LINK_LIBRARIES(complex ${CMAKE_LIB}) # +# Output the files required by 'complex' to a file. +# The 'complex' executable will then test if this file exists and remove it. +# The contents of this file is not tested (absolute paths). +# +#OUTPUT_REQUIRED_FILES(${Complex_SOURCE_DIR}/Executable/complex.cxx +# ${Complex_BINARY_DIR}/Executable/complex-required.txt) + +# # Extra coverage.Not used. # INSTALL_TARGETS(/tmp complex) INSTALL_PROGRAMS(/tmp complex) SOURCE_GROUP(A_GROUP ".cxx") + diff --git a/Tests/ComplexRelativePaths/Executable/complex.cxx b/Tests/ComplexRelativePaths/Executable/complex.cxx index 21576e9..a611b72 100644 --- a/Tests/ComplexRelativePaths/Executable/complex.cxx +++ b/Tests/ComplexRelativePaths/Executable/complex.cxx @@ -5,23 +5,23 @@ #include "cmStandardIncludes.h" #include "cmSystemTools.h" -int passed = 0; -int failed = 0; +int cm_passed = 0; +int cm_failed = 0; // ====================================================================== -void Failed(const char* Message, const char* m2= "") +void cmFailed(const char* Message, const char* m2= "") { std::cerr << "Failed: " << Message << m2 << "\n"; - failed++; + cm_failed++; } // ====================================================================== -void Passed(const char* Message, const char* m2="") +void cmPassed(const char* Message, const char* m2="") { std::cout << "Passed: " << Message << m2 << "\n"; - passed++; + cm_passed++; } // ====================================================================== @@ -30,17 +30,17 @@ void TestAndRemoveFile(const char* filename) { if (!cmSystemTools::FileExists(filename)) { - Failed("Could not find file: ", filename); + cmFailed("Could not find file: ", filename); } else { if (!cmSystemTools::RemoveFile(filename)) { - Failed("Unable to remove file. It does not imply that this test failed, but it *will* be corrupted thereafter if this file is not removed: ", filename); + cmFailed("Unable to remove file. It does not imply that this test failed, but it *will* be corrupted thereafter if this file is not removed: ", filename); } else { - Passed("Find and remove file: ", filename); + cmPassed("Find and remove file: ", filename); } } } @@ -51,17 +51,17 @@ void TestDir(const char* filename) { if (!cmSystemTools::FileExists(filename)) { - Failed("Could not find dir: ", filename); + cmFailed("Could not find dir: ", filename); } else { if (!cmSystemTools::FileIsDirectory(filename)) { - Failed("Unable to check if file is a directory: ", filename); + cmFailed("Unable to check if file is a directory: ", filename); } else { - Passed("Find dir: ", filename); + cmPassed("Find dir: ", filename); } } } @@ -72,85 +72,85 @@ int main() { if(sharedFunction() != 1) { - Failed("Call to sharedFunction from shared library failed."); + cmFailed("Call to sharedFunction from shared library failed."); } else { - Passed("Call to sharedFunction from shared library worked."); + cmPassed("Call to sharedFunction from shared library worked."); } if(file1() != 1) { - Failed("Call to file1 function from library failed."); + cmFailed("Call to file1 function from library failed."); } else { - Passed("Call to file1 function returned 1."); + cmPassed("Call to file1 function returned 1."); } if(file2() != 1) { - Failed("Call to file2 function from library failed."); + cmFailed("Call to file2 function from library failed."); } else { - Passed("Call to file2 function returned 1."); + cmPassed("Call to file2 function returned 1."); } // ---------------------------------------------------------------------- // Test ADD_DEFINITIONS #ifndef CMAKE_IS_FUN - Failed("CMake is not fun, so it is broken and should be fixed."); + cmFailed("CMake is not fun, so it is broken and should be fixed."); #else - Passed("CMAKE_IS_FUN is defined."); + cmPassed("CMAKE_IS_FUN is defined."); #endif // ---------------------------------------------------------------------- // Test SET, VARIABLE_REQUIRES #ifdef SHOULD_NOT_BE_DEFINED - Failed("IF or SET is broken, SHOULD_NOT_BE_DEFINED is defined."); + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED is defined."); #else - Passed("SHOULD_NOT_BE_DEFINED is not defined."); + cmPassed("SHOULD_NOT_BE_DEFINED is not defined."); #endif #ifndef SHOULD_BE_DEFINED - Failed("IF or SET is broken, SHOULD_BE_DEFINED is not defined.\n"); + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED is not defined.\n"); #else - Passed("SHOULD_BE_DEFINED is defined."); + cmPassed("SHOULD_BE_DEFINED is defined."); #endif #ifndef ONE_VAR - Failed("cmakedefine is broken, ONE_VAR is not defined."); + cmFailed("cmakedefine is broken, ONE_VAR is not defined."); #else - Passed("ONE_VAR is defined."); + cmPassed("ONE_VAR is defined."); #endif #ifndef ONE_VAR_IS_DEFINED - Failed("cmakedefine, SET or VARIABLE_REQUIRES is broken, " + cmFailed("cmakedefine, SET or VARIABLE_REQUIRES is broken, " "ONE_VAR_IS_DEFINED is not defined."); #else - Passed("ONE_VAR_IS_DEFINED is defined."); + cmPassed("ONE_VAR_IS_DEFINED is defined."); #endif #ifdef ZERO_VAR - Failed("cmakedefine is broken, ZERO_VAR is defined."); + cmFailed("cmakedefine is broken, ZERO_VAR is defined."); #else - Passed("ZERO_VAR is not defined."); + cmPassed("ZERO_VAR is not defined."); #endif #ifndef STRING_VAR - Failed("the CONFIGURE_FILE command is broken, STRING_VAR is not defined."); + cmFailed("the CONFIGURE_FILE command is broken, STRING_VAR is not defined."); #else if(strcmp(STRING_VAR, "CMake is great") != 0) { - Failed("the SET or CONFIGURE_FILE command is broken. STRING_VAR == ", + cmFailed("the SET or CONFIGURE_FILE command is broken. STRING_VAR == ", STRING_VAR); } else { - Passed("STRING_VAR == ", STRING_VAR); + cmPassed("STRING_VAR == ", STRING_VAR); } #endif @@ -158,71 +158,83 @@ int main() // Test various IF/ELSE combinations #ifdef SHOULD_NOT_BE_DEFINED_AND - Failed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND is defined."); + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND is defined."); #else - Passed("SHOULD_NOT_BE_DEFINED_AND is not defined."); + cmPassed("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"); + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_AND is not defined.\n"); #else - Passed("SHOULD_BE_DEFINED_AND is defined."); + cmPassed("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."); + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR is defined."); #else - Passed("SHOULD_NOT_BE_DEFINED_OR is not defined."); + cmPassed("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"); + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_OR is not defined.\n"); #else - Passed("SHOULD_BE_DEFINED_OR is defined."); + cmPassed("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."); + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES is defined."); #else - Passed("SHOULD_NOT_BE_DEFINED_MATCHES is not defined."); + cmPassed("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"); + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_MATCHES is not defined.\n"); #else - Passed("SHOULD_BE_DEFINED_MATCHES is defined."); + cmPassed("SHOULD_BE_DEFINED_MATCHES is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_COMMAND + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_COMMAND is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_COMMAND is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_COMMAND + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_COMMAND is not defined.\n"); +#else + cmPassed("SHOULD_BE_DEFINED_COMMAND is defined."); #endif // ---------------------------------------------------------------------- // Test FOREACH #ifndef FOREACH_VAR1 - Failed("the FOREACH, SET or CONFIGURE_FILE command is broken, " + cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, " "FOREACH_VAR1 is not defined."); #else if(strcmp(FOREACH_VAR1, "VALUE1") != 0) { - Failed("the FOREACH, SET or CONFIGURE_FILE command is broken, " + cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, " "FOREACH_VAR1 == ", FOREACH_VAR1); } else { - Passed("FOREACH_VAR1 == ", FOREACH_VAR1); + cmPassed("FOREACH_VAR1 == ", FOREACH_VAR1); } #endif #ifndef FOREACH_VAR2 - Failed("the FOREACH, SET or CONFIGURE_FILE command is broken, " + cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, " "FOREACH_VAR2 is not defined."); #else if(strcmp(FOREACH_VAR2, "VALUE2") != 0) { - Failed("the FOREACH, SET or CONFIGURE_FILE command is broken, " + cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, " "FOREACH_VAR2 == ", FOREACH_VAR2); } else { - Passed("FOREACH_VAR2 == ", FOREACH_VAR2); + cmPassed("FOREACH_VAR2 == ", FOREACH_VAR2); } #endif @@ -230,77 +242,77 @@ int main() // Test FIND_FILE, FIND_PATH and various GET_FILENAME_COMPONENT combinations #ifndef FILENAME_VAR_PATH_NAME - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "FILENAME_VAR_PATH_NAME is not defined."); #else if(strcmp(FILENAME_VAR_PATH_NAME, "Complex") != 0) { - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "FILENAME_VAR_PATH_NAME == ", FILENAME_VAR_PATH_NAME); } else { - Passed("FILENAME_VAR_PATH_NAME == ", FILENAME_VAR_PATH_NAME); + cmPassed("FILENAME_VAR_PATH_NAME == ", FILENAME_VAR_PATH_NAME); } #endif #ifndef FILENAME_VAR_NAME - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "FILENAME_VAR_NAME is not defined."); #else if(strcmp(FILENAME_VAR_NAME, "VarTests.cmake") != 0) { - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "FILENAME_VAR_NAME == ", FILENAME_VAR_NAME); } else { - Passed("FILENAME_VAR_NAME == ", FILENAME_VAR_NAME); + cmPassed("FILENAME_VAR_NAME == ", FILENAME_VAR_NAME); } #endif #ifndef FILENAME_VAR_EXT - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "FILENAME_VAR_EXT is not defined."); #else if(strcmp(FILENAME_VAR_EXT, ".cmake") != 0) { - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "FILENAME_VAR_EXT == ", FILENAME_VAR_EXT); } else { - Passed("FILENAME_VAR_EXT == ", FILENAME_VAR_EXT); + cmPassed("FILENAME_VAR_EXT == ", FILENAME_VAR_EXT); } #endif #ifndef FILENAME_VAR_NAME_WE - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "FILENAME_VAR_NAME_WE is not defined."); #else if(strcmp(FILENAME_VAR_NAME_WE, "VarTests") != 0) { - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "FILENAME_VAR_NAME_WE == ", FILENAME_VAR_NAME_WE); } else { - Passed("FILENAME_VAR_NAME_WE == ", FILENAME_VAR_NAME_WE); + cmPassed("FILENAME_VAR_NAME_WE == ", FILENAME_VAR_NAME_WE); } #endif #ifndef PATH_VAR_NAME - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "PATH_VAR_NAME is not defined."); #else if(strcmp(PATH_VAR_NAME, "Complex") != 0) { - Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " + cmFailed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "PATH_VAR_NAME == ", PATH_VAR_NAME); } else { - Passed("PATH_VAR_NAME == ", PATH_VAR_NAME); + cmPassed("PATH_VAR_NAME == ", PATH_VAR_NAME); } #endif @@ -308,47 +320,69 @@ int main() // Test LOAD_CACHE #ifndef CACHE_TEST_VAR1 - Failed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " "CACHE_TEST_VAR1 is not defined."); #else if(strcmp(CACHE_TEST_VAR1, "foo") != 0) { - Failed("the FOREACH, SET or CONFIGURE_FILE command is broken, " + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " "CACHE_TEST_VAR1 == ", CACHE_TEST_VAR1); } else { - Passed("CACHE_TEST_VAR1 == ", CACHE_TEST_VAR1); + cmPassed("CACHE_TEST_VAR1 == ", CACHE_TEST_VAR1); } #endif #ifndef CACHE_TEST_VAR2 - Failed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " "CACHE_TEST_VAR2 is not defined."); #else if(strcmp(CACHE_TEST_VAR2, "bar") != 0) { - Failed("the FOREACH, SET or CONFIGURE_FILE command is broken, " + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " "CACHE_TEST_VAR2 == ", CACHE_TEST_VAR2); } else { - Passed("CACHE_TEST_VAR2 == ", CACHE_TEST_VAR2); + cmPassed("CACHE_TEST_VAR2 == ", CACHE_TEST_VAR2); } #endif #ifndef CACHE_TEST_VAR3 - Failed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " "CACHE_TEST_VAR3 is not defined."); #else if(strcmp(CACHE_TEST_VAR3, "1") != 0) { - Failed("the FOREACH, SET or CONFIGURE_FILE command is broken, " + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " "CACHE_TEST_VAR3 == ", CACHE_TEST_VAR3); } else { - Passed("CACHE_TEST_VAR3 == ", CACHE_TEST_VAR3); + cmPassed("CACHE_TEST_VAR3 == ", CACHE_TEST_VAR3); + } +#endif + +#ifdef CACHE_TEST_VAR_EXCLUDED + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command or cmakedefine is broken, " + "CACHE_TEST_VAR_EXCLUDED is defined (should not have been loaded)."); +#else + cmPassed("CACHE_TEST_VAR_EXCLUDED is not defined."); +#endif + +#ifndef CACHE_TEST_VAR_INTERNAL + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " + "CACHE_TEST_VAR_INTERNAL is not defined."); +#else + if(strcmp(CACHE_TEST_VAR_INTERNAL, "bar") != 0) + { + cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " + "CACHE_TEST_VAR_INTERNAL == ", CACHE_TEST_VAR_INTERNAL); + } + else + { + cmPassed("CACHE_TEST_VAR_INTERNAL == ", CACHE_TEST_VAR_INTERNAL); } #endif @@ -370,13 +404,20 @@ int main() TestDir(BINARY_DIR "/make_dir"); // ---------------------------------------------------------------------- + // Test OUTPUT_REQUIRED_FILES + // The files required by 'complex' have been output to a file. + // The contents of this file is not tested (absolute paths). + + TestAndRemoveFile(BINARY_DIR "/Executable/complex-required.txt"); + + // ---------------------------------------------------------------------- // Summary - std::cout << "Passed: " << passed << "\n"; - if(failed) + std::cout << "Passed: " << cm_passed << "\n"; + if(cm_failed) { - std::cout << "Failed: " << failed << "\n"; - return failed; + std::cout << "Failed: " << cm_failed << "\n"; + return cm_failed; } return 0; diff --git a/Tests/ComplexRelativePaths/Library/CMakeLists.txt b/Tests/ComplexRelativePaths/Library/CMakeLists.txt index 1141555..aaa11ca 100644 --- a/Tests/ComplexRelativePaths/Library/CMakeLists.txt +++ b/Tests/ComplexRelativePaths/Library/CMakeLists.txt @@ -54,4 +54,5 @@ ABSTRACT_FILES( ) INSTALL_FILES(/tmp .h ${Complex_BINARY_DIR}/cmTestConfigure.h) +INSTALL_FILES(/tmp .cxx ${Complex_BINARY_DIR}/cmTestConfigure.h) diff --git a/Tests/ComplexRelativePaths/VarTests.cmake b/Tests/ComplexRelativePaths/VarTests.cmake index 1b6c337..e4fb156 100644 --- a/Tests/ComplexRelativePaths/VarTests.cmake +++ b/Tests/ComplexRelativePaths/VarTests.cmake @@ -40,6 +40,12 @@ ELSE(STRING_VAR MATCHES "^CMake") ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_MATCHES) ENDIF(STRING_VAR MATCHES "^CMake") +IF(COMMAND "IF") + ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_COMMAND) +ELSE(COMMAND "IF") + ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_COMMAND) +ENDIF(COMMAND "IF") + # # Test FOREACH # @@ -58,5 +64,5 @@ GET_FILENAME_COMPONENT(FILENAME_VAR_NAME ${FILENAME_VAR} NAME) GET_FILENAME_COMPONENT(FILENAME_VAR_EXT ${FILENAME_VAR} EXT) GET_FILENAME_COMPONENT(FILENAME_VAR_NAME_WE ${FILENAME_VAR} NAME_WE CACHE) -FIND_PATH(PATH_VAR "VarTests.cmake" ${Complex_SOURCE_DIR}) +FIND_PATH(PATH_VAR "cmTestConfigure.h.in" ${Complex_SOURCE_DIR}) GET_FILENAME_COMPONENT(PATH_VAR_NAME ${PATH_VAR} NAME) diff --git a/Tests/ComplexRelativePaths/cmTestConfigure.h.in b/Tests/ComplexRelativePaths/cmTestConfigure.h.in index bd4f9a3..2ea6388 100644 --- a/Tests/ComplexRelativePaths/cmTestConfigure.h.in +++ b/Tests/ComplexRelativePaths/cmTestConfigure.h.in @@ -25,6 +25,8 @@ #define CACHE_TEST_VAR1 "${CACHE_TEST_VAR1}" #define CACHE_TEST_VAR2 "${CACHE_TEST_VAR2}" #define CACHE_TEST_VAR3 "${CACHE_TEST_VAR3}" +#cmakedefine CACHE_TEST_VAR_EXCLUDED +#define CACHE_TEST_VAR_INTERNAL "${CACHE_TEST_VAR_INTERNAL}" // Test internal CMake vars from C++ flags |