From 482eef71122acf6408e0d5bd02161bb832155f08 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Tue, 27 Apr 2004 09:22:57 -0400 Subject: [PATCH] BUG: Fix aus source dir and add better testing of it --- Source/cmSourceFile.cxx | 16 +++++++++------- Tests/SubDir/AnotherSubdir/pair+int.int.c | 6 ++++++ Tests/SubDir/AnotherSubdir/secondone.c | 6 ++++-- Tests/SubDir/AnotherSubdir/testfromsubdir.c | 8 ++++++-- Tests/SubDir/CMakeLists.txt | 13 ++++++++++++- Tests/SubDir/ThirdSubDir/pair+int.int1.c | 6 ++++++ Tests/SubDir/ThirdSubDir/testfromauxsubdir.c | 14 ++++++++++++++ Tests/SubDir/ThirdSubDir/thirdone.c | 6 ++++++ Tests/SubDir/vcl_algorithm+vcl_pair+double.foo.c | 6 ++++++ 9 files changed, 69 insertions(+), 12 deletions(-) create mode 100644 Tests/SubDir/AnotherSubdir/pair+int.int.c create mode 100644 Tests/SubDir/ThirdSubDir/pair+int.int1.c create mode 100644 Tests/SubDir/ThirdSubDir/testfromauxsubdir.c create mode 100644 Tests/SubDir/ThirdSubDir/thirdone.c create mode 100644 Tests/SubDir/vcl_algorithm+vcl_pair+double.foo.c diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index b8a547ade..ed8d63f3c 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -30,12 +30,8 @@ void cmSourceFile::SetName(const char* name, const char* dir, this->SetProperty("HEADER_FILE_ONLY","1"); - m_SourceName = cmSystemTools::GetFilenamePath(name); - if ( m_SourceName.size() > 0 ) - { - m_SourceName += "/"; - } - m_SourceName += cmSystemTools::GetFilenameWithoutLastExtension(name); + + m_SourceName = name; std::string pathname = dir; @@ -58,6 +54,12 @@ void cmSourceFile::SetName(const char* name, const char* dir, std::string hname = pathname; if(cmSystemTools::FileExists(hname.c_str())) { + m_SourceName = cmSystemTools::GetFilenamePath(name); + if ( m_SourceName.size() > 0 ) + { + m_SourceName += "/"; + } + m_SourceName += cmSystemTools::GetFilenameWithoutLastExtension(name); std::string::size_type pos = hname.rfind('.'); if(pos != std::string::npos) { @@ -74,7 +76,7 @@ void cmSourceFile::SetName(const char* name, const char* dir, // See if the file is a header file if(std::find( headerExts.begin(), headerExts.end(), m_SourceExtension ) == - headerExts.end()) + headerExts.end()) { this->SetProperty("HEADER_FILE_ONLY","0"); } diff --git a/Tests/SubDir/AnotherSubdir/pair+int.int.c b/Tests/SubDir/AnotherSubdir/pair+int.int.c new file mode 100644 index 000000000..b7a623781 --- /dev/null +++ b/Tests/SubDir/AnotherSubdir/pair+int.int.c @@ -0,0 +1,6 @@ +#include + +void pair_stuff() +{ + printf("Placeholder for a strange file in subdirectory\n"); +} diff --git a/Tests/SubDir/AnotherSubdir/secondone.c b/Tests/SubDir/AnotherSubdir/secondone.c index b55d05f43..3e9e5afe6 100644 --- a/Tests/SubDir/AnotherSubdir/secondone.c +++ b/Tests/SubDir/AnotherSubdir/secondone.c @@ -1,4 +1,6 @@ -const char* secondone() +#include + +void secondone() { - return "Hello again"; + printf("Hello again\n"); } diff --git a/Tests/SubDir/AnotherSubdir/testfromsubdir.c b/Tests/SubDir/AnotherSubdir/testfromsubdir.c index b784b1622..34b6e7a88 100644 --- a/Tests/SubDir/AnotherSubdir/testfromsubdir.c +++ b/Tests/SubDir/AnotherSubdir/testfromsubdir.c @@ -1,10 +1,14 @@ #include -const char* secondone(); +void secondone(); +void pair_stuff(); +void vcl_stuff(); int main() { printf("Hello from subdirectory\n"); - printf("SO: %s\n", secondone()); + secondone(); + pair_stuff(); + vcl_stuff(); return 0; } diff --git a/Tests/SubDir/CMakeLists.txt b/Tests/SubDir/CMakeLists.txt index a1da9b609..5cf885945 100644 --- a/Tests/SubDir/CMakeLists.txt +++ b/Tests/SubDir/CMakeLists.txt @@ -2,4 +2,15 @@ PROJECT(SUBDIR) SUBDIRS(Executable EXCLUDE_FROM_ALL Examples) WRITE_FILE(${SUBDIR_BINARY_DIR}/ShouldBeHere "This file should exist.") -ADD_EXECUTABLE(TestFromSubdir AnotherSubdir/testfromsubdir.c AnotherSubdir/secondone) +ADD_EXECUTABLE(TestFromSubdir + AnotherSubdir/testfromsubdir.c + AnotherSubdir/secondone + AnotherSubdir/pair+int.int.c + vcl_algorithm+vcl_pair+double.foo.c + ) + +AUX_SOURCE_DIRECTORY(ThirdSubDir SOURCES) +SET(SOURCES ${SOURCES} + vcl_algorithm+vcl_pair+double.foo.c) +MESSAGE("Sources: ${SOURCES}") +ADD_EXECUTABLE(TestWithAuxSourceDir ${SOURCES}) diff --git a/Tests/SubDir/ThirdSubDir/pair+int.int1.c b/Tests/SubDir/ThirdSubDir/pair+int.int1.c new file mode 100644 index 000000000..b7a623781 --- /dev/null +++ b/Tests/SubDir/ThirdSubDir/pair+int.int1.c @@ -0,0 +1,6 @@ +#include + +void pair_stuff() +{ + printf("Placeholder for a strange file in subdirectory\n"); +} diff --git a/Tests/SubDir/ThirdSubDir/testfromauxsubdir.c b/Tests/SubDir/ThirdSubDir/testfromauxsubdir.c new file mode 100644 index 000000000..34b6e7a88 --- /dev/null +++ b/Tests/SubDir/ThirdSubDir/testfromauxsubdir.c @@ -0,0 +1,14 @@ +#include + +void secondone(); +void pair_stuff(); +void vcl_stuff(); + +int main() +{ + printf("Hello from subdirectory\n"); + secondone(); + pair_stuff(); + vcl_stuff(); + return 0; +} diff --git a/Tests/SubDir/ThirdSubDir/thirdone.c b/Tests/SubDir/ThirdSubDir/thirdone.c new file mode 100644 index 000000000..3e9e5afe6 --- /dev/null +++ b/Tests/SubDir/ThirdSubDir/thirdone.c @@ -0,0 +1,6 @@ +#include + +void secondone() +{ + printf("Hello again\n"); +} diff --git a/Tests/SubDir/vcl_algorithm+vcl_pair+double.foo.c b/Tests/SubDir/vcl_algorithm+vcl_pair+double.foo.c new file mode 100644 index 000000000..a0c60f75a --- /dev/null +++ b/Tests/SubDir/vcl_algorithm+vcl_pair+double.foo.c @@ -0,0 +1,6 @@ +#include + +void vcl_stuff() +{ + printf("Placeholder for a file with strange name\n"); +}