From fd26d148d8b71871bc5abe2f4e48b56d142d6be0 Mon Sep 17 00:00:00 2001 From: Ken Martin Date: Tue, 13 Sep 2005 10:40:38 -0400 Subject: ENH: test get directory properties ability to get props from subdirs --- Tests/OutOfSource/CMakeLists.txt | 15 +++++++++++---- Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt | 4 ++++ Tests/OutOfSource/OutOfSourceSubdir/simple.cxx | 11 ++++++++++- Tests/OutOfSource/testdp.h.in | 1 + 4 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 Tests/OutOfSource/testdp.h.in diff --git a/Tests/OutOfSource/CMakeLists.txt b/Tests/OutOfSource/CMakeLists.txt index e6c4f97..a053f14 100644 --- a/Tests/OutOfSource/CMakeLists.txt +++ b/Tests/OutOfSource/CMakeLists.txt @@ -1,6 +1,13 @@ -# a simple test case -PROJECT (OutOfSource) +# a simple test cas +project (OutOfSource) -ADD_SUBDIRECTORY(SubDir) +add_subdirectory(SubDir) -SET(KEN 1) +get_directory_property(ANIMAL DIRECTORY OutOfSourceSubdir DEFINITION WEASELS) + +configure_file( + ${OutOfSource_SOURCE_DIR}/testdp.h.in + ${OutOfSource_BINARY_DIR}/SubDir/OutOfSourceSubdir/testdp.h + ) + +set(KEN 1) diff --git a/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt b/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt index 412a1ca..3180f28 100644 --- a/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt +++ b/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt @@ -1,3 +1,5 @@ +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) + IF ("${PROJECT_SOURCE_DIR}" STREQUAL "${ANOTHER_PROJ_SOURCE_DIR}") SET(BUILD_SHARED_LIBS 1) ADD_LIBRARY(testlib testlib.cxx) @@ -5,3 +7,5 @@ IF ("${PROJECT_SOURCE_DIR}" STREQUAL "${ANOTHER_PROJ_SOURCE_DIR}") TARGET_LINK_LIBRARIES(simple testlib) ENDIF ("${PROJECT_SOURCE_DIR}" STREQUAL "${ANOTHER_PROJ_SOURCE_DIR}") +# test getting a definition from a subdir +SET (WEASELS SIZZLING) diff --git a/Tests/OutOfSource/OutOfSourceSubdir/simple.cxx b/Tests/OutOfSource/OutOfSourceSubdir/simple.cxx index cfb1f1a..e06777d 100644 --- a/Tests/OutOfSource/OutOfSourceSubdir/simple.cxx +++ b/Tests/OutOfSource/OutOfSourceSubdir/simple.cxx @@ -1,7 +1,16 @@ +#include +#include + #include "testlib.h" +#include "testdp.h" int main () -{ +{ + if (strcmp(animal,"SIZZLING")) + { + fprintf(stderr,"Get definitions from a subdir did not work\n"); + return -2; + } if(TestLib() != 1.0) { return -1; diff --git a/Tests/OutOfSource/testdp.h.in b/Tests/OutOfSource/testdp.h.in new file mode 100644 index 0000000..2ca99d5 --- /dev/null +++ b/Tests/OutOfSource/testdp.h.in @@ -0,0 +1 @@ +char *animal = "${ANIMAL}"; -- cgit v0.12