summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2007-02-19 18:20:27 (GMT)
committerKen Martin <ken.martin@kitware.com>2007-02-19 18:20:27 (GMT)
commit09699018ccccf654ce6ca4d0b84e3e2a973f5c22 (patch)
tree8ce7ba16e859b5f7c5340bbff22ea852618f7ead /Source
parent314f5f60a08cc2366a18126fdc69aa367a01b046 (diff)
downloadCMake-09699018ccccf654ce6ca4d0b84e3e2a973f5c22.zip
CMake-09699018ccccf654ce6ca4d0b84e3e2a973f5c22.tar.gz
CMake-09699018ccccf654ce6ca4d0b84e3e2a973f5c22.tar.bz2
ENH: turn on spaces in path test
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt12
-rw-r--r--Source/cmTarget.cxx51
-rw-r--r--Source/cmTarget.h4
3 files changed, 65 insertions, 2 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 735feb6..a41add3 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -991,6 +991,18 @@ IF(BUILD_TESTING)
)
ENDIF(NOT CMAKE_TEST_DIFFERENT_GENERATOR)
+ ADD_TEST(SubDirSpaces ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/SubDirSpaces"
+ "${CMake_BINARY_DIR}/Tests/SubDirSpaces"
+ --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubDirSpaces/Executable"
+ --build-generator ${CMAKE_TEST_GENERATOR}
+ --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
+ --build-project SUBDIR
+ --test-command test
+ "${CMake_BINARY_DIR}/Tests/SubDirSpaces/ShouldBeHere"
+ "${CMake_BINARY_DIR}/Tests/SubDirSpaces/testfromsubdir.obj"
+ )
IF (WIN32)
ADD_TEST(SubDir ${CMAKE_CTEST_COMMAND}
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 3bd0d30..a60ae28 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -233,6 +233,12 @@ void cmTarget::DefineProperties(cmake *cm)
"(such as \".so\") on a library name.");
cm->DefineProperty
+ ("TEST_LOCATION", cmProperty::TARGET,
+ "Where a target will be written on disk for ctest.",
+ "Much like the LOCATION property but makes use of "
+ "CTEST_TEST_CONFIGURATION to handle the build configuration.");
+
+ cm->DefineProperty
("VERSION", cmProperty::TARGET,
"What version number is this target.",
"For shared libraries VERSION and SOVERSION can be used to specify "
@@ -1147,6 +1153,25 @@ const char* cmTarget::GetLocation(const char* config)
return this->Location.c_str();
}
+const char* cmTarget::GetTestLocation(const char* config)
+{
+ this->Location = this->GetDirectory();
+ if(!this->Location.empty())
+ {
+ this->Location += "/";
+ }
+ const char* cfgid = this->Makefile->GetDefinition("CMAKE_CFG_INTDIR");
+ // if this platform has configurations, then use the ctest var
+ if(cfgid && strcmp(cfgid, ".") != 0)
+ {
+ this->Location += "${CTEST_CONFIGURATION_TYPE}";
+ this->Location += "/";
+ }
+ this->Location += this->GetFullName(config, false);
+ return this->Location.c_str();
+}
+
+
//----------------------------------------------------------------------------
void cmTarget::GetTargetVersion(int& major, int& minor)
{
@@ -1237,16 +1262,38 @@ const char *cmTarget::GetProperty(const char* prop,
// variable in the location.
this->SetProperty("LOCATION", this->GetLocation(0));
}
+
+ if (!strcmp(prop,"TEST_LOCATION"))
+ {
+ // Set the LOCATION property of the target. Note that this cannot take
+ // into account the per-configuration name of the target because the
+ // configuration type may not be known at CMake time. We should
+ // deprecate this feature and instead support transforming an executable
+ // target name given as the command part of custom commands into the
+ // proper path at build time. Alternatively we could put environment
+ // variable settings in all custom commands that hold the name of the
+ // target for each configuration and then give a reference to the
+ // variable in the location.
+ this->SetProperty("TEST_LOCATION", this->GetTestLocation(0));
+ }
+ else
+
if(strcmp(prop, "OBJECT_FILES") == 0)
{
this->ComputeObjectFiles();
}
+
// Per-configuration location can be computed.
int len = static_cast<int>(strlen(prop));
if(len > 9 && strcmp(prop+len-9, "_LOCATION") == 0)
{
- std::string configName(prop, len-9);
- this->SetProperty(prop, this->GetLocation(configName.c_str()));
+ // Per-configuration location can be computed.
+ int len = static_cast<int>(strlen(prop));
+ if(len > 9 && strcmp(prop+len-9, "_LOCATION") == 0)
+ {
+ std::string configName(prop, len-9);
+ this->SetProperty(prop, this->GetLocation(configName.c_str()));
+ }
}
// the type property returns what type the target is
if (!strcmp(prop,"TYPE"))
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index de216f3..d6444c9 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -181,6 +181,10 @@ public:
target property. */
const char* GetLocation(const char* config);
+ /** Get the location of the target in the build tree for use by ctest.
+ May make use of the CTEST_TEST_CONFIGURATION variable in ctest. */
+ const char* GetTestLocation(const char* config);
+
/** Get the target major and minor version numbers interpreted from
the VERSION property. Version 0 is returned if the property is
not set or cannot be parsed. */