summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/include_directories.rst2
-rw-r--r--Help/manual/cmake-variables.7.rst2
-rw-r--r--Help/prop_tgt/INCLUDE_DIRECTORIES.rst13
-rw-r--r--Help/variable/CMAKE_INCLUDE_DIRECTORIES_BEFORE.rst8
-rw-r--r--Help/variable/CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE.rst8
-rw-r--r--Modules/CPack.cmake5
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/cmCPackDragNDropGenerator.cxx7
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx63
-rw-r--r--Source/CTest/cmCTestScriptHandler.h3
-rw-r--r--Source/cmGeneratorTarget.cxx23
-rw-r--r--Source/cmGeneratorTarget.h20
-rw-r--r--Source/cmTarget.cxx14
-rw-r--r--Source/cmTarget.h14
-rw-r--r--Tests/CMakeLists.txt11
-rw-r--r--Tests/CPackComponentsForAll/CMakeLists.txt3
-rw-r--r--Tests/CPackComponentsForAll/license.txt3
-rw-r--r--Tests/CTestTestEmptyBinaryDirectory/test.cmake.in66
18 files changed, 220 insertions, 47 deletions
diff --git a/Help/command/include_directories.rst b/Help/command/include_directories.rst
index 6744427..3e0c7a0 100644
--- a/Help/command/include_directories.rst
+++ b/Help/command/include_directories.rst
@@ -19,7 +19,7 @@ used by the generators.
By default the directories are appended onto the current list of
directories. This default behavior can be changed by setting
-CMAKE_INCLUDE_DIRECTORIES_BEFORE to ON. By using AFTER or BEFORE
+:variable:`CMAKE_INCLUDE_DIRECTORIES_BEFORE` to ON. By using AFTER or BEFORE
explicitly, you can select between appending and prepending,
independent of the default.
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 26205a8..59e8064 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -97,6 +97,8 @@ Variables that Change Behavior
/variable/CMAKE_FIND_NO_INSTALL_PREFIX
/variable/CMAKE_IGNORE_PATH
/variable/CMAKE_INCLUDE_PATH
+ /variable/CMAKE_INCLUDE_DIRECTORIES_BEFORE
+ /variable/CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE
/variable/CMAKE_INSTALL_DEFAULT_COMPONENT_NAME
/variable/CMAKE_INSTALL_PREFIX
/variable/CMAKE_LIBRARY_PATH
diff --git a/Help/prop_tgt/INCLUDE_DIRECTORIES.rst b/Help/prop_tgt/INCLUDE_DIRECTORIES.rst
index 40709a4..cf358b3 100644
--- a/Help/prop_tgt/INCLUDE_DIRECTORIES.rst
+++ b/Help/prop_tgt/INCLUDE_DIRECTORIES.rst
@@ -5,17 +5,20 @@ List of preprocessor include file search directories.
This property specifies the list of directories given so far to the
include_directories command. This property exists on directories and
-targets. In addition to accepting values from the include_directories
+targets. In addition to accepting values from the :command:`include_directories`
command, values may be set directly on any directory or any target
-using the set_property command. A target gets its initial value for
+using the :command:`set_property` command. A target gets its initial value for
this property from the value of the directory property. A directory
gets its initial value from its parent directory if it has one. Both
directory and target property values are adjusted by calls to the
-include_directories command.
+:command:`include_directories` command.
The target property values are used by the generators to set the
-include paths for the compiler. See also the include_directories
-command.
+include paths for the compiler. See also the :command:`include_directories`
+and :command:`target_include_directories` commands.
+
+Relative paths should not be added to this property directly. Use one of
+the commands above instead to handle relative paths.
Contents of INCLUDE_DIRECTORIES may use "generator expressions" with the
syntax "$<...>". See the :manual:`cmake-generator-expressions(7)` manual for
diff --git a/Help/variable/CMAKE_INCLUDE_DIRECTORIES_BEFORE.rst b/Help/variable/CMAKE_INCLUDE_DIRECTORIES_BEFORE.rst
new file mode 100644
index 0000000..3c1fbcf
--- /dev/null
+++ b/Help/variable/CMAKE_INCLUDE_DIRECTORIES_BEFORE.rst
@@ -0,0 +1,8 @@
+CMAKE_INCLUDE_DIRECTORIES_BEFORE
+--------------------------------
+
+Whether to append or prepend directories by default in :command:`include_directories`.
+
+This variable affects the default behavior of the :command:`include_directories`
+command. Setting this variable to 'ON' is equivalent to using the BEFORE option
+in all uses of that command.
diff --git a/Help/variable/CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE.rst b/Help/variable/CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE.rst
new file mode 100644
index 0000000..cbd04d7
--- /dev/null
+++ b/Help/variable/CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE.rst
@@ -0,0 +1,8 @@
+CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE
+----------------------------------------
+
+Whether to force prepending of project include directories.
+
+This variable affects the order of include directories generated in compiler
+command lines. If set to 'ON', it causes the :variable:`CMAKE_SOURCE_DIR` and
+the :variable:`CMAKE_BINARY_DIR` to appear first.
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
index da6b2e0..2d641f5 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -519,6 +519,11 @@ cpack_set_if_not_set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "")
# WiX specific variables
cpack_set_if_not_set(CPACK_WIX_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P}")
+# set sysroot so SDK tools can be used
+if(CMAKE_OSX_SYSROOT)
+ cpack_set_if_not_set(CPACK_OSX_SYSROOT "${CMAKE_OSX_SYSROOT}")
+endif()
+
if(DEFINED CPACK_COMPONENTS_ALL)
if(CPACK_MONOLITHIC_INSTALL)
message("CPack warning: both CPACK_COMPONENTS_ALL and CPACK_MONOLITHIC_INSTALL have been set.\nDefaulting to a monolithic installation.")
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index a9c3b98..47caddd 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -2,5 +2,5 @@
set(CMake_VERSION_MAJOR 2)
set(CMake_VERSION_MINOR 8)
set(CMake_VERSION_PATCH 12)
-set(CMake_VERSION_TWEAK 20131102)
+set(CMake_VERSION_TWEAK 20131104)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx
index d973c01..dfb2f15 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.cxx
+++ b/Source/CPack/cmCPackDragNDropGenerator.cxx
@@ -474,7 +474,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
udco_image_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
udco_image_command << " convert \"" << temp_image << "\"";
udco_image_command << " -format UDCO";
- udco_image_command << " -o \"" << temp_udco << "\"";
+ udco_image_command << " -ov -o \"" << temp_udco << "\"";
std::string error;
if(!this->RunCommand(udco_image_command, &error))
@@ -504,6 +504,11 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
// Rez the SLA
cmOStringStream embed_sla_command;
embed_sla_command << this->GetOption("CPACK_COMMAND_REZ");
+ const char* sysroot = this->GetOption("CPACK_OSX_SYSROOT");
+ if(sysroot && sysroot[0] != '\0')
+ {
+ embed_sla_command << " -isysroot \"" << sysroot << "\"";
+ }
embed_sla_command << " \"" << sla_r << "\"";
embed_sla_command << " -a -o ";
embed_sla_command << "\"" << temp_udco << "\"";
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 64bcd59..7d33cf3 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -22,6 +22,7 @@
//#include <cmsys/RegularExpression.hxx>
#include <cmsys/Process.h>
+#include <cmsys/Directory.hxx>
// used for sleep
#ifdef _WIN32
@@ -1056,15 +1057,71 @@ bool cmCTestScriptHandler::EmptyBinaryDirectory(const char *sname)
return false;
}
+ // consider non existing target directory a success
+ if(!cmSystemTools::FileExists(sname))
+ {
+ return true;
+ }
+
// try to avoid deleting directories that we shouldn't
std::string check = sname;
check += "/CMakeCache.txt";
- if(cmSystemTools::FileExists(check.c_str()) &&
- !cmSystemTools::RemoveADirectory(sname))
+
+ if(!cmSystemTools::FileExists(check.c_str()))
{
return false;
}
- return true;
+
+ for(int i = 0; i < 5; ++i)
+ {
+ if(TryToRemoveBinaryDirectoryOnce(sname))
+ {
+ return true;
+ }
+ cmSystemTools::Delay(100);
+ }
+
+ return false;
+}
+
+//-------------------------------------------------------------------------
+bool cmCTestScriptHandler::TryToRemoveBinaryDirectoryOnce(
+ const std::string& directoryPath)
+{
+ cmsys::Directory directory;
+ directory.Load(directoryPath.c_str());
+
+ for(unsigned long i = 0; i < directory.GetNumberOfFiles(); ++i)
+ {
+ std::string path = directory.GetFile(i);
+
+ if(path == "." || path == ".." || path == "CMakeCache.txt")
+ {
+ continue;
+ }
+
+ std::string fullPath = directoryPath + std::string("/") + path;
+
+ bool isDirectory = cmSystemTools::FileIsDirectory(fullPath.c_str()) &&
+ !cmSystemTools::FileIsSymlink(fullPath.c_str());
+
+ if(isDirectory)
+ {
+ if(!cmSystemTools::RemoveADirectory(fullPath.c_str()))
+ {
+ return false;
+ }
+ }
+ else
+ {
+ if(!cmSystemTools::RemoveFile(fullPath.c_str()))
+ {
+ return false;
+ }
+ }
+ }
+
+ return cmSystemTools::RemoveADirectory(directoryPath.c_str());
}
//-------------------------------------------------------------------------
diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h
index 80d5831..44e9dd0 100644
--- a/Source/CTest/cmCTestScriptHandler.h
+++ b/Source/CTest/cmCTestScriptHandler.h
@@ -135,6 +135,9 @@ private:
// Add ctest command
void AddCTestCommand(cmCTestCommand* command);
+ // Try to remove the binary directory once
+ static bool TryToRemoveBinaryDirectoryOnce(const std::string& directoryPath);
+
std::vector<cmStdString> ConfigurationScripts;
std::vector<bool> ScriptProcessScope;
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index b512675..b964f71 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -42,16 +42,16 @@ const char *cmGeneratorTarget::GetName() const
}
//----------------------------------------------------------------------------
-const char *cmGeneratorTarget::GetProperty(const char *prop)
+const char *cmGeneratorTarget::GetProperty(const char *prop) const
{
return this->Target->GetProperty(prop);
}
//----------------------------------------------------------------------------
std::vector<cmSourceFile*> const*
-cmGeneratorTarget::GetSourceDepends(cmSourceFile* sf)
+cmGeneratorTarget::GetSourceDepends(cmSourceFile* sf) const
{
- SourceEntriesType::iterator i = this->SourceEntries.find(sf);
+ SourceEntriesType::const_iterator i = this->SourceEntries.find(sf);
if(i != this->SourceEntries.end())
{
return &i->second.Depends;
@@ -61,7 +61,7 @@ cmGeneratorTarget::GetSourceDepends(cmSourceFile* sf)
//----------------------------------------------------------------------------
bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir,
- const char *config)
+ const char *config) const
{
std::string config_upper;
if(config && *config)
@@ -70,7 +70,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir,
}
typedef std::map<std::string, std::vector<std::string> > IncludeCacheType;
- IncludeCacheType::iterator iter =
+ IncludeCacheType::const_iterator iter =
this->SystemIncludesCache.find(config_upper);
if (iter == this->SystemIncludesCache.end())
@@ -111,13 +111,13 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir,
}
//----------------------------------------------------------------------------
-bool cmGeneratorTarget::GetPropertyAsBool(const char *prop)
+bool cmGeneratorTarget::GetPropertyAsBool(const char *prop) const
{
return this->Target->GetPropertyAsBool(prop);
}
//----------------------------------------------------------------------------
-std::vector<cmSourceFile*> const& cmGeneratorTarget::GetSourceFiles()
+std::vector<cmSourceFile*> const& cmGeneratorTarget::GetSourceFiles() const
{
return this->Target->GetSourceFiles();
}
@@ -270,7 +270,8 @@ void cmGeneratorTarget::LookupObjectLibraries()
}
//----------------------------------------------------------------------------
-void cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs)
+void
+cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs) const
{
for(std::vector<cmTarget*>::const_iterator
ti = this->ObjectLibraries.begin();
@@ -571,7 +572,7 @@ void cmGeneratorTarget::TraceDependencies()
//----------------------------------------------------------------------------
void cmGeneratorTarget::GetAppleArchs(const char* config,
- std::vector<std::string>& archVec)
+ std::vector<std::string>& archVec) const
{
const char* archs = 0;
if(config && *config)
@@ -591,7 +592,7 @@ void cmGeneratorTarget::GetAppleArchs(const char* config,
}
//----------------------------------------------------------------------------
-const char* cmGeneratorTarget::GetCreateRuleVariable()
+const char* cmGeneratorTarget::GetCreateRuleVariable() const
{
switch(this->GetType())
{
@@ -617,7 +618,7 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories(
}
//----------------------------------------------------------------------------
-void cmGeneratorTarget::GenerateTargetManifest(const char* config)
+void cmGeneratorTarget::GenerateTargetManifest(const char* config) const
{
if (this->Target->IsImported())
{
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index a99f54b..177bc25 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -28,9 +28,9 @@ public:
int GetType() const;
const char *GetName() const;
- const char *GetProperty(const char *prop);
- bool GetPropertyAsBool(const char *prop);
- std::vector<cmSourceFile*> const& GetSourceFiles();
+ const char *GetProperty(const char *prop) const;
+ bool GetPropertyAsBool(const char *prop) const;
+ std::vector<cmSourceFile*> const& GetSourceFiles() const;
cmTarget* Target;
cmMakefile* Makefile;
@@ -60,22 +60,22 @@ public:
std::vector<cmTarget*> ObjectLibraries;
- void UseObjectLibraries(std::vector<std::string>& objs);
+ void UseObjectLibraries(std::vector<std::string>& objs) const;
void GetAppleArchs(const char* config,
- std::vector<std::string>& archVec);
+ std::vector<std::string>& archVec) const;
///! Return the rule variable used to create this type of target,
// need to add CMAKE_(LANG) for full name.
- const char* GetCreateRuleVariable();
+ const char* GetCreateRuleVariable() const;
/** Get the include directories for this target. */
std::vector<std::string> GetIncludeDirectories(const char *config);
- bool IsSystemIncludeDirectory(const char *dir, const char *config);
+ bool IsSystemIncludeDirectory(const char *dir, const char *config) const;
/** Add the target output files to the global generator manifest. */
- void GenerateTargetManifest(const char* config);
+ void GenerateTargetManifest(const char* config) const;
/**
* Trace through the source files in this target and add al source files
@@ -87,14 +87,14 @@ public:
void LookupObjectLibraries();
/** Get sources that must be built before the given source. */
- std::vector<cmSourceFile*> const* GetSourceDepends(cmSourceFile* sf);
+ std::vector<cmSourceFile*> const* GetSourceDepends(cmSourceFile* sf) const;
struct SourceEntry { std::vector<cmSourceFile*> Depends; };
typedef std::map<cmSourceFile*, SourceEntry> SourceEntriesType;
SourceEntriesType SourceEntries;
private:
- std::map<std::string, std::vector<std::string> > SystemIncludesCache;
+ mutable std::map<std::string, std::vector<std::string> > SystemIncludesCache;
cmGeneratorTarget(cmGeneratorTarget const&);
void operator=(cmGeneratorTarget const&);
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 7e87514..d0390f7 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -510,7 +510,7 @@ bool cmTarget::FindSourceFiles()
}
//----------------------------------------------------------------------------
-std::vector<cmSourceFile*> const& cmTarget::GetSourceFiles()
+std::vector<cmSourceFile*> const& cmTarget::GetSourceFiles() const
{
return this->SourceFiles;
}
@@ -3078,7 +3078,7 @@ std::string cmTarget::GetSOName(const char* config) const
}
//----------------------------------------------------------------------------
-bool cmTarget::HasMacOSXRpath(const char* config)
+bool cmTarget::HasMacOSXRpath(const char* config) const
{
bool install_name_is_rpath = false;
bool macosx_rpath = this->GetPropertyAsBool("MACOSX_RPATH");
@@ -3225,7 +3225,7 @@ cmTarget::GetFullNameImported(const char* config, bool implib) const
//----------------------------------------------------------------------------
void cmTarget::GetFullNameComponents(std::string& prefix, std::string& base,
std::string& suffix, const char* config,
- bool implib)
+ bool implib) const
{
this->GetFullNameInternal(config, implib, prefix, base, suffix);
}
@@ -3661,7 +3661,7 @@ bool cmTarget::HaveInstallTreeRPATH() const
}
//----------------------------------------------------------------------------
-bool cmTarget::NeedRelinkBeforeInstall(const char* config)
+bool cmTarget::NeedRelinkBeforeInstall(const char* config) const
{
// Only executables and shared libraries can have an rpath and may
// need relinking.
@@ -3724,7 +3724,7 @@ bool cmTarget::NeedRelinkBeforeInstall(const char* config)
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetInstallNameDirForBuildTree(const char* config)
+std::string cmTarget::GetInstallNameDirForBuildTree(const char* config) const
{
// If building directly for installation then the build tree install_name
// is the same as the install tree.
@@ -3757,7 +3757,7 @@ std::string cmTarget::GetInstallNameDirForBuildTree(const char* config)
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetInstallNameDirForInstallTree()
+std::string cmTarget::GetInstallNameDirForInstallTree() const
{
if(this->Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
{
@@ -5774,7 +5774,7 @@ std::string cmTarget::BuildMacContentDirectory(const std::string& base,
//----------------------------------------------------------------------------
std::string cmTarget::GetMacContentDirectory(const char* config,
- bool implib)
+ bool implib) const
{
// Start with the output directory for the target.
std::string fpath = this->GetDirectory(config, implib);
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index eae5009..fbb4914 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -124,7 +124,7 @@ public:
/**
* Get the list of the source files used by this target
*/
- std::vector<cmSourceFile*> const& GetSourceFiles();
+ std::vector<cmSourceFile*> const& GetSourceFiles() const;
void AddSourceFile(cmSourceFile* sf);
std::vector<std::string> const& GetObjectLibraries() const
{
@@ -361,7 +361,7 @@ public:
std::string GetFullName(const char* config=0, bool implib = false) const;
void GetFullNameComponents(std::string& prefix,
std::string& base, std::string& suffix,
- const char* config=0, bool implib = false);
+ const char* config=0, bool implib = false) const;
/** Get the name of the pdb file for the target. */
std::string GetPDBName(const char* config=0) const;
@@ -373,7 +373,7 @@ public:
std::string GetSOName(const char* config) const;
/** Whether this library has \@rpath and platform supports it. */
- bool HasMacOSXRpath(const char* config);
+ bool HasMacOSXRpath(const char* config) const;
/** Test for special case of a third-party shared library that has
no soname at all. */
@@ -409,7 +409,7 @@ public:
/**
* Compute whether this target must be relinked before installing.
*/
- bool NeedRelinkBeforeInstall(const char* config);
+ bool NeedRelinkBeforeInstall(const char* config) const;
bool HaveBuildTreeRPATH(const char *config) const;
bool HaveInstallTreeRPATH() const;
@@ -420,11 +420,11 @@ public:
/** Return the install name directory for the target in the
* build tree. For example: "\@rpath/", "\@loader_path/",
* or "/full/path/to/library". */
- std::string GetInstallNameDirForBuildTree(const char* config);
+ std::string GetInstallNameDirForBuildTree(const char* config) const;
/** Return the install name directory for the target in the
* install tree. For example: "\@rpath/" or "\@loader_path/". */
- std::string GetInstallNameDirForInstallTree();
+ std::string GetInstallNameDirForInstallTree() const;
cmComputeLinkInformation* GetLinkInformation(const char* config,
cmTarget const* head = 0) const;
@@ -497,7 +497,7 @@ public:
/** @return the mac content directory for this target. */
std::string GetMacContentDirectory(const char* config,
- bool implib);
+ bool implib) const;
/** @return whether this target have a well defined output file name. */
bool HaveWellDefinedOutputFiles() const;
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 7c939ed..d4a55fc 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1943,6 +1943,17 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
PASS_REGULAR_EXPRESSION "Upload\\.xml")
configure_file(
+ "${CMake_SOURCE_DIR}/Tests/CTestTestEmptyBinaryDirectory/test.cmake.in"
+ "${CMake_BINARY_DIR}/Tests/CTestTestEmptyBinaryDirectory/test.cmake"
+ @ONLY ESCAPE_QUOTES)
+ add_test(CTestTestEmptyBinaryDirectory ${CMAKE_CTEST_COMMAND}
+ -S "${CMake_BINARY_DIR}/Tests/CTestTestEmptyBinaryDirectory/test.cmake" -V
+ --output-log "${CMake_BINARY_DIR}/Tests/CTestTestEmptyBinaryDirectory/testOut.log"
+ )
+ set_tests_properties(CTestTestEmptyBinaryDirectory PROPERTIES
+ PASS_REGULAR_EXPRESSION "TEST_SUCCESS")
+
+ configure_file(
"${CMake_SOURCE_DIR}/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir1/test1.cmake"
@ONLY ESCAPE_QUOTES)
diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt
index 8162f0c..ff40e30 100644
--- a/Tests/CPackComponentsForAll/CMakeLists.txt
+++ b/Tests/CPackComponentsForAll/CMakeLists.txt
@@ -59,6 +59,7 @@ set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "2")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "CPack Component Example")
+set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/license.txt)
# Tell CPack all of the components to install. The "ALL"
# refers to the fact that this is the set of components that
@@ -120,4 +121,4 @@ if (NOT ("${CPackComponentWay}" STREQUAL "default"))
set(CPACK_PROJECT_CONFIG_FILE ${CPackComponentsForAll_BINARY_DIR}/MyLibCPackConfig-${CPackComponentWay}.cmake)
endif ()
# Include CPack to introduce the appropriate targets
-include(CPack) \ No newline at end of file
+include(CPack)
diff --git a/Tests/CPackComponentsForAll/license.txt b/Tests/CPackComponentsForAll/license.txt
new file mode 100644
index 0000000..ba8ba48
--- /dev/null
+++ b/Tests/CPackComponentsForAll/license.txt
@@ -0,0 +1,3 @@
+LICENSE
+-------
+This is an installer created using CPack (http://www.cmake.org). No license provided.
diff --git a/Tests/CTestTestEmptyBinaryDirectory/test.cmake.in b/Tests/CTestTestEmptyBinaryDirectory/test.cmake.in
new file mode 100644
index 0000000..8eb808f
--- /dev/null
+++ b/Tests/CTestTestEmptyBinaryDirectory/test.cmake.in
@@ -0,0 +1,66 @@
+cmake_minimum_required(VERSION 2.8.12)
+
+set(CTEST_RUN_CURRENT_SCRIPT 0)
+
+set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestEmptyBinaryDirectory")
+set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestEmptyBinaryDirectory")
+
+# make sure ctest does not remove directories without a CMakeCache.txt in it
+set(EMPTY_BINARY_DIR "${CTEST_BINARY_DIRECTORY}/empty_binary_dir")
+file(MAKE_DIRECTORY "${EMPTY_BINARY_DIR}")
+
+if(NOT EXISTS "${EMPTY_BINARY_DIR}"
+ OR EXISTS "${EMPTY_BINARY_DIR}/CMakeCache.txt")
+ message(FATAL_ERROR "empty_binary_dir precondition failed")
+endif()
+
+ctest_empty_binary_directory("${EMPTY_BINARY_DIR}")
+
+if(NOT EXISTS "${EMPTY_BINARY_DIR}")
+ message(FATAL_ERROR "empty_binary_dir should not have been removed")
+endif()
+
+# make sure ctest does remove directories with a CMakeCache.txt
+set(VALID_BINARY_DIR "${CTEST_BINARY_DIRECTORY}/valid_binary_dir")
+file(MAKE_DIRECTORY "${VALID_BINARY_DIR}")
+file(WRITE "${VALID_BINARY_DIR}/CMakeCache.txt")
+
+if(NOT EXISTS "${VALID_BINARY_DIR}"
+ OR NOT EXISTS "${VALID_BINARY_DIR}/CMakeCache.txt")
+ message(FATAL_ERROR "valid_binary_dir precondition failed")
+endif()
+
+ctest_empty_binary_directory("${VALID_BINARY_DIR}")
+
+if(EXISTS "${VALID_BINARY_DIR}")
+ message(FATAL_ERROR "valid_binary_dir should have been removed")
+endif()
+
+# make sure ctest removes build directories recursively
+set(DEEP_BINARY_DIR "${CTEST_BINARY_DIRECTORY}/deep_binary_dir")
+file(MAKE_DIRECTORY "${DEEP_BINARY_DIR}")
+file(WRITE "${DEEP_BINARY_DIR}/CMakeCache.txt")
+
+foreach(SUBDIR A Z A/A A/Z Z/A Z/Z)
+ set(FULL_SUBDIR "${DEEP_BINARY_DIR}/${SUBDIR}")
+ file(MAKE_DIRECTORY "${FULL_SUBDIR}")
+
+ foreach(SUBFILE A.cpp Z.bat)
+ set(FULL_SUBFILE "${FULL_SUBDIR}/${SUBFILE}")
+ file(WRITE "${FULL_SUBFILE}" "I am '${FULL_SUBFILE}'")
+ endforeach()
+endforeach()
+
+if(NOT EXISTS "${DEEP_BINARY_DIR}"
+ OR NOT EXISTS "${DEEP_BINARY_DIR}/CMakeCache.txt"
+ OR NOT EXISTS "${DEEP_BINARY_DIR}/Z/A/Z.bat")
+ message(FATAL_ERROR "deep_binary_dir precondition failed")
+endif()
+
+ctest_empty_binary_directory("${DEEP_BINARY_DIR}")
+
+if(EXISTS "${DEEP_BINARY_DIR}")
+ message(FATAL_ERROR "deep_binary_dir should have been removed")
+endif()
+
+message("TEST_SUCCESS")