BUG: Fix aus source dir and add better testing of it

This commit is contained in:
Andy Cedilnik 2004-04-27 09:22:57 -04:00
parent c19a70b3ad
commit 482eef7112
9 changed files with 69 additions and 12 deletions

View File

@ -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");
}

View File

@ -0,0 +1,6 @@
#include <stdio.h>
void pair_stuff()
{
printf("Placeholder for a strange file in subdirectory\n");
}

View File

@ -1,4 +1,6 @@
const char* secondone()
#include <stdio.h>
void secondone()
{
return "Hello again";
printf("Hello again\n");
}

View File

@ -1,10 +1,14 @@
#include <stdio.h>
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;
}

View File

@ -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})

View File

@ -0,0 +1,6 @@
#include <stdio.h>
void pair_stuff()
{
printf("Placeholder for a strange file in subdirectory\n");
}

View File

@ -0,0 +1,14 @@
#include <stdio.h>
void secondone();
void pair_stuff();
void vcl_stuff();
int main()
{
printf("Hello from subdirectory\n");
secondone();
pair_stuff();
vcl_stuff();
return 0;
}

View File

@ -0,0 +1,6 @@
#include <stdio.h>
void secondone()
{
printf("Hello again\n");
}

View File

@ -0,0 +1,6 @@
#include <stdio.h>
void vcl_stuff()
{
printf("Placeholder for a file with strange name\n");
}