summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2006-03-22 20:01:22 (GMT)
committerKen Martin <ken.martin@kitware.com>2006-03-22 20:01:22 (GMT)
commiteb773486f35791edbbb2305023fb81bb7c206e85 (patch)
tree50ddaff3579bcf6670ece83b148cc1648a01116c
parenta2d8447fb942fb67211bd91efb510592bc26bab7 (diff)
downloadCMake-eb773486f35791edbbb2305023fb81bb7c206e85.zip
CMake-eb773486f35791edbbb2305023fb81bb7c206e85.tar.gz
CMake-eb773486f35791edbbb2305023fb81bb7c206e85.tar.bz2
ENH: added testing for new features
-rw-r--r--Tests/Complex/Executable/CMakeLists.txt19
-rw-r--r--Tests/Complex/Executable/Included.cmake2
-rw-r--r--Tests/Complex/Executable/complex.cxx36
-rw-r--r--Tests/Complex/VarTests.cmake8
-rw-r--r--Tests/ComplexOneConfig/Executable/CMakeLists.txt19
-rw-r--r--Tests/ComplexOneConfig/Executable/Included.cmake2
-rw-r--r--Tests/ComplexOneConfig/Executable/complex.cxx36
-rw-r--r--Tests/ComplexOneConfig/VarTests.cmake8
-rw-r--r--Tests/ComplexRelativePaths/Executable/CMakeLists.txt19
-rw-r--r--Tests/ComplexRelativePaths/Executable/Included.cmake2
-rw-r--r--Tests/ComplexRelativePaths/Executable/complex.cxx36
-rw-r--r--Tests/ComplexRelativePaths/VarTests.cmake8
12 files changed, 195 insertions, 0 deletions
diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt
index 768e0fa..78eb7a6 100644
--- a/Tests/Complex/Executable/CMakeLists.txt
+++ b/Tests/Complex/Executable/CMakeLists.txt
@@ -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}
diff --git a/Tests/Complex/Executable/Included.cmake b/Tests/Complex/Executable/Included.cmake
new file mode 100644
index 0000000..2d1ea3e
--- /dev/null
+++ b/Tests/Complex/Executable/Included.cmake
@@ -0,0 +1,2 @@
+GET_DIRECTORY_PROPERTY(LF_VALUE LISTFILE_STACK)
+
diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx
index 81ef44e..60308a4 100644
--- a/Tests/Complex/Executable/complex.cxx
+++ b/Tests/Complex/Executable/complex.cxx
@@ -462,6 +462,30 @@ int main()
#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
#ifdef SHOULD_NOT_BE_DEFINED
@@ -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
diff --git a/Tests/Complex/VarTests.cmake b/Tests/Complex/VarTests.cmake
index 477fab9..c146d1b 100644
--- a/Tests/Complex/VarTests.cmake
+++ b/Tests/Complex/VarTests.cmake
@@ -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")
diff --git a/Tests/ComplexOneConfig/Executable/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/CMakeLists.txt
index 768e0fa..78eb7a6 100644
--- a/Tests/ComplexOneConfig/Executable/CMakeLists.txt
+++ b/Tests/ComplexOneConfig/Executable/CMakeLists.txt
@@ -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}
diff --git a/Tests/ComplexOneConfig/Executable/Included.cmake b/Tests/ComplexOneConfig/Executable/Included.cmake
new file mode 100644
index 0000000..2d1ea3e
--- /dev/null
+++ b/Tests/ComplexOneConfig/Executable/Included.cmake
@@ -0,0 +1,2 @@
+GET_DIRECTORY_PROPERTY(LF_VALUE LISTFILE_STACK)
+
diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx
index 81ef44e..60308a4 100644
--- a/Tests/ComplexOneConfig/Executable/complex.cxx
+++ b/Tests/ComplexOneConfig/Executable/complex.cxx
@@ -462,6 +462,30 @@ int main()
#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
#ifdef SHOULD_NOT_BE_DEFINED
@@ -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
diff --git a/Tests/ComplexOneConfig/VarTests.cmake b/Tests/ComplexOneConfig/VarTests.cmake
index 477fab9..c146d1b 100644
--- a/Tests/ComplexOneConfig/VarTests.cmake
+++ b/Tests/ComplexOneConfig/VarTests.cmake
@@ -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")
diff --git a/Tests/ComplexRelativePaths/Executable/CMakeLists.txt b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt
index 768e0fa..78eb7a6 100644
--- a/Tests/ComplexRelativePaths/Executable/CMakeLists.txt
+++ b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt
@@ -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}
diff --git a/Tests/ComplexRelativePaths/Executable/Included.cmake b/Tests/ComplexRelativePaths/Executable/Included.cmake
new file mode 100644
index 0000000..2d1ea3e
--- /dev/null
+++ b/Tests/ComplexRelativePaths/Executable/Included.cmake
@@ -0,0 +1,2 @@
+GET_DIRECTORY_PROPERTY(LF_VALUE LISTFILE_STACK)
+
diff --git a/Tests/ComplexRelativePaths/Executable/complex.cxx b/Tests/ComplexRelativePaths/Executable/complex.cxx
index 81ef44e..60308a4 100644
--- a/Tests/ComplexRelativePaths/Executable/complex.cxx
+++ b/Tests/ComplexRelativePaths/Executable/complex.cxx
@@ -462,6 +462,30 @@ int main()
#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
#ifdef SHOULD_NOT_BE_DEFINED
@@ -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
diff --git a/Tests/ComplexRelativePaths/VarTests.cmake b/Tests/ComplexRelativePaths/VarTests.cmake
index 477fab9..c146d1b 100644
--- a/Tests/ComplexRelativePaths/VarTests.cmake
+++ b/Tests/ComplexRelativePaths/VarTests.cmake
@@ -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")