ENH: added testing for new features

This commit is contained in:
Ken Martin 2006-03-22 15:01:22 -05:00
parent a2d8447fb9
commit eb773486f3
12 changed files with 195 additions and 0 deletions

View File

@ -36,6 +36,25 @@ ELSE(UNIX)
ENDIF(NOT BORLAND)
ENDIF (UNIX)
# can we get the path to a source file
GET_SOURCE_FILE_PROPERTY(A_LOCATION A.cxx LOCATION)
IF ("${A_LOCATION}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/A.cxx")
ADD_DEFINITIONS(-DCMAKE_FOUND_ACXX)
ENDIF ("${A_LOCATION}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/A.cxx")
# get the directory parent
GET_DIRECTORY_PROPERTY(P_VALUE PARENT_DIRECTORY)
IF ("${P_VALUE}" STREQUAL "${CMAKE_SOURCE_DIR}")
ADD_DEFINITIONS(-DCMAKE_FOUND_PARENT)
ENDIF ("${P_VALUE}" STREQUAL "${CMAKE_SOURCE_DIR}")
# get the stack of listfiles
INCLUDE(Included.cmake)
IF ("${LF_VALUE}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt;${CMAKE_CURRENT_SOURCE_DIR}/Included.cmake")
ADD_DEFINITIONS(-DCMAKE_FOUND_LISTFILE_STACK)
ENDIF ("${LF_VALUE}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt;${CMAKE_CURRENT_SOURCE_DIR}/Included.cmake")
# Test pre-build/pre-link/post-build rules for an executable.
ADD_CUSTOM_COMMAND(TARGET complex PRE_BUILD
COMMAND ${CREATE_FILE_EXE}

View File

@ -0,0 +1,2 @@
GET_DIRECTORY_PROPERTY(LF_VALUE LISTFILE_STACK)

View File

@ -461,6 +461,30 @@ int main()
cmFailed("Variable args for MACROs are failing.");
#endif
// ----------------------------------------------------------------------
// Test GET_SOURCE_FILE_PROPERTY for location
#ifndef CMAKE_FOUND_ACXX
cmFailed("CMake did not get the location of A.cxx correctly");
#else
cmPassed("CMake found A.cxx properly");
#endif
// ----------------------------------------------------------------------
// Test GET_DIRECTORY_PROPERTY for parent
#ifndef CMAKE_FOUND_PARENT
cmFailed("CMake did not get the location of the parent directory properly");
#else
cmPassed("CMake found the parent directory properly");
#endif
// ----------------------------------------------------------------------
// Test GET_DIRECTORY_PROPERTY for listfiles
#ifndef CMAKE_FOUND_LISTFILE_STACK
cmFailed("CMake did not get the listfile stack properly");
#else
cmPassed("CMake found the listfile stack properly");
#endif
// ----------------------------------------------------------------------
// Test SET, VARIABLE_REQUIRES
@ -656,6 +680,18 @@ int main()
cmPassed("SHOULD_BE_DEFINED_EXISTS2 is defined.");
#endif
#ifndef SHOULD_BE_DEFINED_IS_DIRECTORY
cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_IS_DIRECTORY is not defined.\n");
#else
cmPassed("SHOULD_BE_DEFINED_IS_DIRECTORY is defined.");
#endif
#ifndef SHOULD_BE_DEFINED_IS_DIRECTORY2
cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_IS_DIRECTORY2 is not defined.\n");
#else
cmPassed("SHOULD_BE_DEFINED_IS_DIRECTORY2 is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_LESS
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_LESS is defined.");
#else

View File

@ -95,6 +95,14 @@ ELSE(EXISTS ${Complex_SOURCE_DIR}/roquefort.txt)
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_EXISTS2)
ENDIF (EXISTS ${Complex_SOURCE_DIR}/roquefort.txt)
IF (IS_DIRECTORY ${Complex_SOURCE_DIR})
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_IS_DIRECTORY)
ENDIF (IS_DIRECTORY ${Complex_SOURCE_DIR})
IF (NOT IS_DIRECTORY ${Complex_SOURCE_DIR}/VarTests.cmake)
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_IS_DIRECTORY2)
ENDIF (NOT IS_DIRECTORY ${Complex_SOURCE_DIR}/VarTests.cmake)
SET (SNUM1_VAR "1")
SET (SNUM2_VAR "2")
SET (SNUM3_VAR "1")

View File

@ -36,6 +36,25 @@ ELSE(UNIX)
ENDIF(NOT BORLAND)
ENDIF (UNIX)
# can we get the path to a source file
GET_SOURCE_FILE_PROPERTY(A_LOCATION A.cxx LOCATION)
IF ("${A_LOCATION}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/A.cxx")
ADD_DEFINITIONS(-DCMAKE_FOUND_ACXX)
ENDIF ("${A_LOCATION}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/A.cxx")
# get the directory parent
GET_DIRECTORY_PROPERTY(P_VALUE PARENT_DIRECTORY)
IF ("${P_VALUE}" STREQUAL "${CMAKE_SOURCE_DIR}")
ADD_DEFINITIONS(-DCMAKE_FOUND_PARENT)
ENDIF ("${P_VALUE}" STREQUAL "${CMAKE_SOURCE_DIR}")
# get the stack of listfiles
INCLUDE(Included.cmake)
IF ("${LF_VALUE}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt;${CMAKE_CURRENT_SOURCE_DIR}/Included.cmake")
ADD_DEFINITIONS(-DCMAKE_FOUND_LISTFILE_STACK)
ENDIF ("${LF_VALUE}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt;${CMAKE_CURRENT_SOURCE_DIR}/Included.cmake")
# Test pre-build/pre-link/post-build rules for an executable.
ADD_CUSTOM_COMMAND(TARGET complex PRE_BUILD
COMMAND ${CREATE_FILE_EXE}

View File

@ -0,0 +1,2 @@
GET_DIRECTORY_PROPERTY(LF_VALUE LISTFILE_STACK)

View File

@ -461,6 +461,30 @@ int main()
cmFailed("Variable args for MACROs are failing.");
#endif
// ----------------------------------------------------------------------
// Test GET_SOURCE_FILE_PROPERTY for location
#ifndef CMAKE_FOUND_ACXX
cmFailed("CMake did not get the location of A.cxx correctly");
#else
cmPassed("CMake found A.cxx properly");
#endif
// ----------------------------------------------------------------------
// Test GET_DIRECTORY_PROPERTY for parent
#ifndef CMAKE_FOUND_PARENT
cmFailed("CMake did not get the location of the parent directory properly");
#else
cmPassed("CMake found the parent directory properly");
#endif
// ----------------------------------------------------------------------
// Test GET_DIRECTORY_PROPERTY for listfiles
#ifndef CMAKE_FOUND_LISTFILE_STACK
cmFailed("CMake did not get the listfile stack properly");
#else
cmPassed("CMake found the listfile stack properly");
#endif
// ----------------------------------------------------------------------
// Test SET, VARIABLE_REQUIRES
@ -656,6 +680,18 @@ int main()
cmPassed("SHOULD_BE_DEFINED_EXISTS2 is defined.");
#endif
#ifndef SHOULD_BE_DEFINED_IS_DIRECTORY
cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_IS_DIRECTORY is not defined.\n");
#else
cmPassed("SHOULD_BE_DEFINED_IS_DIRECTORY is defined.");
#endif
#ifndef SHOULD_BE_DEFINED_IS_DIRECTORY2
cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_IS_DIRECTORY2 is not defined.\n");
#else
cmPassed("SHOULD_BE_DEFINED_IS_DIRECTORY2 is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_LESS
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_LESS is defined.");
#else

View File

@ -95,6 +95,14 @@ ELSE(EXISTS ${Complex_SOURCE_DIR}/roquefort.txt)
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_EXISTS2)
ENDIF (EXISTS ${Complex_SOURCE_DIR}/roquefort.txt)
IF (IS_DIRECTORY ${Complex_SOURCE_DIR})
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_IS_DIRECTORY)
ENDIF (IS_DIRECTORY ${Complex_SOURCE_DIR})
IF (NOT IS_DIRECTORY ${Complex_SOURCE_DIR}/VarTests.cmake)
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_IS_DIRECTORY2)
ENDIF (NOT IS_DIRECTORY ${Complex_SOURCE_DIR}/VarTests.cmake)
SET (SNUM1_VAR "1")
SET (SNUM2_VAR "2")
SET (SNUM3_VAR "1")

View File

@ -36,6 +36,25 @@ ELSE(UNIX)
ENDIF(NOT BORLAND)
ENDIF (UNIX)
# can we get the path to a source file
GET_SOURCE_FILE_PROPERTY(A_LOCATION A.cxx LOCATION)
IF ("${A_LOCATION}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/A.cxx")
ADD_DEFINITIONS(-DCMAKE_FOUND_ACXX)
ENDIF ("${A_LOCATION}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/A.cxx")
# get the directory parent
GET_DIRECTORY_PROPERTY(P_VALUE PARENT_DIRECTORY)
IF ("${P_VALUE}" STREQUAL "${CMAKE_SOURCE_DIR}")
ADD_DEFINITIONS(-DCMAKE_FOUND_PARENT)
ENDIF ("${P_VALUE}" STREQUAL "${CMAKE_SOURCE_DIR}")
# get the stack of listfiles
INCLUDE(Included.cmake)
IF ("${LF_VALUE}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt;${CMAKE_CURRENT_SOURCE_DIR}/Included.cmake")
ADD_DEFINITIONS(-DCMAKE_FOUND_LISTFILE_STACK)
ENDIF ("${LF_VALUE}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt;${CMAKE_CURRENT_SOURCE_DIR}/Included.cmake")
# Test pre-build/pre-link/post-build rules for an executable.
ADD_CUSTOM_COMMAND(TARGET complex PRE_BUILD
COMMAND ${CREATE_FILE_EXE}

View File

@ -0,0 +1,2 @@
GET_DIRECTORY_PROPERTY(LF_VALUE LISTFILE_STACK)

View File

@ -461,6 +461,30 @@ int main()
cmFailed("Variable args for MACROs are failing.");
#endif
// ----------------------------------------------------------------------
// Test GET_SOURCE_FILE_PROPERTY for location
#ifndef CMAKE_FOUND_ACXX
cmFailed("CMake did not get the location of A.cxx correctly");
#else
cmPassed("CMake found A.cxx properly");
#endif
// ----------------------------------------------------------------------
// Test GET_DIRECTORY_PROPERTY for parent
#ifndef CMAKE_FOUND_PARENT
cmFailed("CMake did not get the location of the parent directory properly");
#else
cmPassed("CMake found the parent directory properly");
#endif
// ----------------------------------------------------------------------
// Test GET_DIRECTORY_PROPERTY for listfiles
#ifndef CMAKE_FOUND_LISTFILE_STACK
cmFailed("CMake did not get the listfile stack properly");
#else
cmPassed("CMake found the listfile stack properly");
#endif
// ----------------------------------------------------------------------
// Test SET, VARIABLE_REQUIRES
@ -656,6 +680,18 @@ int main()
cmPassed("SHOULD_BE_DEFINED_EXISTS2 is defined.");
#endif
#ifndef SHOULD_BE_DEFINED_IS_DIRECTORY
cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_IS_DIRECTORY is not defined.\n");
#else
cmPassed("SHOULD_BE_DEFINED_IS_DIRECTORY is defined.");
#endif
#ifndef SHOULD_BE_DEFINED_IS_DIRECTORY2
cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_IS_DIRECTORY2 is not defined.\n");
#else
cmPassed("SHOULD_BE_DEFINED_IS_DIRECTORY2 is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_LESS
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_LESS is defined.");
#else

View File

@ -95,6 +95,14 @@ ELSE(EXISTS ${Complex_SOURCE_DIR}/roquefort.txt)
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_EXISTS2)
ENDIF (EXISTS ${Complex_SOURCE_DIR}/roquefort.txt)
IF (IS_DIRECTORY ${Complex_SOURCE_DIR})
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_IS_DIRECTORY)
ENDIF (IS_DIRECTORY ${Complex_SOURCE_DIR})
IF (NOT IS_DIRECTORY ${Complex_SOURCE_DIR}/VarTests.cmake)
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_IS_DIRECTORY2)
ENDIF (NOT IS_DIRECTORY ${Complex_SOURCE_DIR}/VarTests.cmake)
SET (SNUM1_VAR "1")
SET (SNUM2_VAR "2")
SET (SNUM3_VAR "1")