summaryrefslogtreecommitdiffstats
path: root/Tests/ComplexRelativePaths/Executable
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 /Tests/ComplexRelativePaths/Executable
parenta2d8447fb942fb67211bd91efb510592bc26bab7 (diff)
downloadCMake-eb773486f35791edbbb2305023fb81bb7c206e85.zip
CMake-eb773486f35791edbbb2305023fb81bb7c206e85.tar.gz
CMake-eb773486f35791edbbb2305023fb81bb7c206e85.tar.bz2
ENH: added testing for new features
Diffstat (limited to 'Tests/ComplexRelativePaths/Executable')
-rw-r--r--Tests/ComplexRelativePaths/Executable/CMakeLists.txt19
-rw-r--r--Tests/ComplexRelativePaths/Executable/Included.cmake2
-rw-r--r--Tests/ComplexRelativePaths/Executable/complex.cxx36
3 files changed, 57 insertions, 0 deletions
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