Add FOLDER target property, for IDEs (#3796)

This work was started from a patch by Thomas Schiffer.
Thanks, Thomas!

See the newly added documentation of the FOLDER target
property for details.

Also added global properties, USE_FOLDERS and
PREDEFINED_TARGETS_FOLDER. See new docs here, too.

By default, the FOLDER target property is used to organize
targets into folders in IDEs that have support for such
organization.

This commit adds "solution folder" support to the Visual
Studio generators. Currently works with versions 7 through
10.

Also, use the new FOLDER property in the ExternalProject
test and in the CMake project itself.
This commit is contained in:
David Cole 2010-09-03 13:53:22 -04:00
parent 11756b9608
commit e6ac0aacf6
12 changed files with 292 additions and 2 deletions

View File

@ -173,6 +173,18 @@ MACRO(CMAKE_SETUP_TESTING)
ENDMACRO(CMAKE_SETUP_TESTING) ENDMACRO(CMAKE_SETUP_TESTING)
MACRO(CMAKE_SET_TARGET_FOLDER tgt folder)
# Really, I just want this to be an "if(TARGET ${tgt})" ...
# but I'm not sure that our min req'd., CMake 2.4.5 can handle
# that... so I'm just activating this for now, with a version
# compare, and only for MSVC builds.
IF(MSVC)
IF(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.8)
SET_PROPERTY(TARGET "${tgt}" PROPERTY FOLDER "${folder}")
ENDIF()
ENDIF()
ENDMACRO(CMAKE_SET_TARGET_FOLDER)
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
# a macro to build the utilities used by CMake # a macro to build the utilities used by CMake
@ -192,6 +204,16 @@ MACRO (CMAKE_BUILD_UTILITIES)
SET(KWSYS_HEADER_ROOT ${CMake_BINARY_DIR}/Source) SET(KWSYS_HEADER_ROOT ${CMake_BINARY_DIR}/Source)
SET(KWSYS_INSTALL_DOC_DIR "${CMake_DOC_DEST}") SET(KWSYS_INSTALL_DOC_DIR "${CMake_DOC_DEST}")
ADD_SUBDIRECTORY(Source/kwsys) ADD_SUBDIRECTORY(Source/kwsys)
SET(kwsys_folder "Utilities/KWSys")
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE} "${kwsys_folder}")
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}_c "${kwsys_folder}")
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}EncodeExecutable "${kwsys_folder}")
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}ProcessFwd9x "${kwsys_folder}")
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestDynload "${kwsys_folder}")
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestProcess "${kwsys_folder}")
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestsC "${kwsys_folder}")
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestsCxx "${kwsys_folder}")
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestSharedForward "${kwsys_folder}")
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# Setup third-party libraries. # Setup third-party libraries.
@ -221,6 +243,7 @@ MACRO (CMAKE_BUILD_UTILITIES)
SET(CMAKE_ZLIB_INCLUDES) SET(CMAKE_ZLIB_INCLUDES)
SET(CMAKE_ZLIB_LIBRARIES cmzlib) SET(CMAKE_ZLIB_LIBRARIES cmzlib)
ADD_SUBDIRECTORY(Utilities/cmzlib) ADD_SUBDIRECTORY(Utilities/cmzlib)
CMAKE_SET_TARGET_FOLDER(cmzlib "Utilities/3rdParty")
ENDIF(CMAKE_USE_SYSTEM_ZLIB) ENDIF(CMAKE_USE_SYSTEM_ZLIB)
#--------------------------------------------------------------------- #---------------------------------------------------------------------
@ -247,6 +270,8 @@ MACRO (CMAKE_BUILD_UTILITIES)
SET(CMAKE_CURL_TEST_URL "${CMAKE_TESTS_CDASH_SERVER}/user.php") SET(CMAKE_CURL_TEST_URL "${CMAKE_TESTS_CDASH_SERVER}/user.php")
ENDIF(CMAKE_TESTS_CDASH_SERVER) ENDIF(CMAKE_TESTS_CDASH_SERVER)
ADD_SUBDIRECTORY(Utilities/cmcurl) ADD_SUBDIRECTORY(Utilities/cmcurl)
CMAKE_SET_TARGET_FOLDER(cmcurl "Utilities/3rdParty")
CMAKE_SET_TARGET_FOLDER(LIBCURL "Utilities/3rdParty")
ENDIF(CMAKE_USE_SYSTEM_CURL) ENDIF(CMAKE_USE_SYSTEM_CURL)
#--------------------------------------------------------------------- #---------------------------------------------------------------------
@ -255,6 +280,7 @@ MACRO (CMAKE_BUILD_UTILITIES)
"${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmcompress") "${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmcompress")
SET(CMAKE_COMPRESS_LIBRARIES "cmcompress") SET(CMAKE_COMPRESS_LIBRARIES "cmcompress")
ADD_SUBDIRECTORY(Utilities/cmcompress) ADD_SUBDIRECTORY(Utilities/cmcompress)
CMAKE_SET_TARGET_FOLDER(cmcompress "Utilities/3rdParty")
IF(CMAKE_USE_SYSTEM_BZIP2) IF(CMAKE_USE_SYSTEM_BZIP2)
FIND_PACKAGE(BZip2) FIND_PACKAGE(BZip2)
ELSE() ELSE()
@ -262,6 +288,7 @@ MACRO (CMAKE_BUILD_UTILITIES)
"${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmbzip2") "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmbzip2")
SET(BZIP2_LIBRARIES cmbzip2) SET(BZIP2_LIBRARIES cmbzip2)
ADD_SUBDIRECTORY(Utilities/cmbzip2) ADD_SUBDIRECTORY(Utilities/cmbzip2)
CMAKE_SET_TARGET_FOLDER(cmbzip2 "Utilities/3rdParty")
ENDIF() ENDIF()
IF(CMAKE_USE_SYSTEM_LIBARCHIVE) IF(CMAKE_USE_SYSTEM_LIBARCHIVE)
FIND_PACKAGE(libarchive) FIND_PACKAGE(libarchive)
@ -275,6 +302,7 @@ MACRO (CMAKE_BUILD_UTILITIES)
SET(BUILD_ARCHIVE_WITHIN_CMAKE TRUE) SET(BUILD_ARCHIVE_WITHIN_CMAKE TRUE)
ADD_DEFINITIONS(-DLIBARCHIVE_STATIC) ADD_DEFINITIONS(-DLIBARCHIVE_STATIC)
ADD_SUBDIRECTORY(Utilities/cmlibarchive) ADD_SUBDIRECTORY(Utilities/cmlibarchive)
CMAKE_SET_TARGET_FOLDER(cmlibarchive "Utilities/3rdParty")
SET(CMAKE_TAR_LIBRARIES cmlibarchive ${BZIP2_LIBRARIES}) SET(CMAKE_TAR_LIBRARIES cmlibarchive ${BZIP2_LIBRARIES})
ENDIF(CMAKE_USE_SYSTEM_LIBARCHIVE) ENDIF(CMAKE_USE_SYSTEM_LIBARCHIVE)
@ -292,6 +320,7 @@ MACRO (CMAKE_BUILD_UTILITIES)
SET(CMAKE_EXPAT_INCLUDES) SET(CMAKE_EXPAT_INCLUDES)
SET(CMAKE_EXPAT_LIBRARIES cmexpat) SET(CMAKE_EXPAT_LIBRARIES cmexpat)
ADD_SUBDIRECTORY(Utilities/cmexpat) ADD_SUBDIRECTORY(Utilities/cmexpat)
CMAKE_SET_TARGET_FOLDER(cmexpat "Utilities/3rdParty")
ENDIF(CMAKE_USE_SYSTEM_EXPAT) ENDIF(CMAKE_USE_SYSTEM_EXPAT)
#--------------------------------------------------------------------- #---------------------------------------------------------------------
@ -521,6 +550,10 @@ ADD_SUBDIRECTORY(Source)
ADD_SUBDIRECTORY(Utilities) ADD_SUBDIRECTORY(Utilities)
ADD_SUBDIRECTORY(Tests) ADD_SUBDIRECTORY(Tests)
CMAKE_SET_TARGET_FOLDER(CMakeLibTests "Tests")
CMAKE_SET_TARGET_FOLDER(cmw9xcom "Utilities/Win9xCompat")
CMAKE_SET_TARGET_FOLDER(documentation "Documentation")
# add a test # add a test
ADD_TEST(SystemInformationNew "${CMAKE_CMAKE_COMMAND}" ADD_TEST(SystemInformationNew "${CMAKE_CMAKE_COMMAND}"
--system-information -G "${CMAKE_TEST_GENERATOR}" ) --system-information -G "${CMAKE_TEST_GENERATOR}" )

View File

@ -65,6 +65,7 @@ IF(NOT _CTEST_TARGETS_ADDED)
${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode} ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}
) )
SET_PROPERTY(TARGET ${mode} PROPERTY RULE_LAUNCH_CUSTOM "") SET_PROPERTY(TARGET ${mode} PROPERTY RULE_LAUNCH_CUSTOM "")
SET_PROPERTY(TARGET ${mode} PROPERTY FOLDER "CTestDashboardTargets")
ENDFOREACH(mode) ENDFOREACH(mode)
# For Makefile generators add more granular targets. # For Makefile generators add more granular targets.
@ -79,6 +80,7 @@ IF(NOT _CTEST_TARGETS_ADDED)
${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}${testtype} ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}${testtype}
) )
SET_PROPERTY(TARGET ${mode}${testtype} PROPERTY RULE_LAUNCH_CUSTOM "") SET_PROPERTY(TARGET ${mode}${testtype} PROPERTY RULE_LAUNCH_CUSTOM "")
SET_PROPERTY(TARGET ${mode}${testtype} PROPERTY FOLDER "CTestDashboardTargets")
ENDFOREACH(testtype) ENDFOREACH(testtype)
ENDFOREACH(mode) ENDFOREACH(mode)
ENDIF("${CMAKE_GENERATOR}" MATCHES Make) ENDIF("${CMAKE_GENERATOR}" MATCHES Make)

View File

@ -1837,6 +1837,38 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
} }
} }
//----------------------------------------------------------------------------
const char* cmGlobalGenerator::GetPredefinedTargetsFolder()
{
const char* prop =
this->GetCMakeInstance()->GetProperty("PREDEFINED_TARGETS_FOLDER");
if (prop)
{
return prop;
}
return "CMakePredefinedTargets";
}
//----------------------------------------------------------------------------
bool cmGlobalGenerator::UseFolderProperty()
{
const char* prop = this->GetCMakeInstance()->GetProperty("USE_FOLDERS");
// If this property is defined, let the setter turn this on or off...
//
if (prop)
{
return cmSystemTools::IsOn(prop);
}
// By default, this feature is ON:
//
return true;
}
//----------------------------------------------------------------------------
cmTarget cmGlobalGenerator::CreateGlobalTarget( cmTarget cmGlobalGenerator::CreateGlobalTarget(
const char* name, const char* message, const char* name, const char* message,
const cmCustomCommandLines* commandLines, const cmCustomCommandLines* commandLines,
@ -1866,6 +1898,14 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(
{ {
target.AddUtility(dit->c_str()); target.AddUtility(dit->c_str());
} }
// Organize in the "predefined targets" folder:
//
if (this->UseFolderProperty())
{
target.SetProperty("FOLDER", this->GetPredefinedTargetsFolder());
}
return target; return target;
} }

View File

@ -320,6 +320,9 @@ protected:
// All targets in the entire project. // All targets in the entire project.
std::map<cmStdString,cmTarget *> TotalTargets; std::map<cmStdString,cmTarget *> TotalTargets;
virtual const char* GetPredefinedTargetsFolder();
virtual bool UseFolderProperty();
private: private:
float FirstTimeProgress; float FirstTimeProgress;
// If you add a new map here, make sure it is copied // If you add a new map here, make sure it is copied

View File

@ -111,6 +111,13 @@ void cmGlobalVisualStudio71Generator
OrderedTargetDependSet orderedProjectTargets(projectTargets); OrderedTargetDependSet orderedProjectTargets(projectTargets);
this->WriteTargetsToSolution(fout, root, orderedProjectTargets); this->WriteTargetsToSolution(fout, root, orderedProjectTargets);
bool useFolderProperty = this->UseFolderProperty();
if (useFolderProperty)
{
this->WriteFolders(fout);
}
// Write out the configurations information for the solution // Write out the configurations information for the solution
fout << "Global\n"; fout << "Global\n";
// Write out the configurations for the solution // Write out the configurations for the solution
@ -120,6 +127,15 @@ void cmGlobalVisualStudio71Generator
// Write out the configurations for all the targets in the project // Write out the configurations for all the targets in the project
this->WriteTargetConfigurations(fout, root, orderedProjectTargets); this->WriteTargetConfigurations(fout, root, orderedProjectTargets);
fout << "\tEndGlobalSection\n"; fout << "\tEndGlobalSection\n";
if (useFolderProperty)
{
// Write out project folders
fout << "\tGlobalSection(NestedProjects) = preSolution\n";
this->WriteFoldersContent(fout);
fout << "\tEndGlobalSection\n";
}
// Write the footer for the SLN file // Write the footer for the SLN file
this->WriteSLNFooter(fout); this->WriteSLNFooter(fout);
} }

View File

@ -300,6 +300,48 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
cmLocalGenerator::START_OUTPUT); cmLocalGenerator::START_OUTPUT);
this->WriteProject(fout, vcprojName, dir.c_str(), this->WriteProject(fout, vcprojName, dir.c_str(),
*target); *target);
// Create "solution folder" information from FOLDER target property
//
if (this->UseFolderProperty())
{
const char *targetFolder = target->GetProperty("FOLDER");
if (targetFolder)
{
std::vector<cmsys::String> tokens =
cmSystemTools::SplitString(targetFolder, '/', false);
std::string cumulativePath = "";
for(std::vector<cmsys::String>::iterator iter = tokens.begin();
iter != tokens.end(); ++iter)
{
if(!iter->size())
{
continue;
}
if (cumulativePath.empty())
{
cumulativePath = *iter;
}
else
{
VisualStudioFolders[cumulativePath].insert(
cumulativePath + "/" + *iter);
cumulativePath = cumulativePath + "/" + *iter;
}
this->CreateGUID(cumulativePath.c_str());
}
if (!cumulativePath.empty())
{
VisualStudioFolders[cumulativePath].insert(target->GetName());
}
}
}
} }
} }
} }
@ -327,6 +369,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetDepends(
} }
} }
//----------------------------------------------------------------------------
// Write a SLN file to the stream // Write a SLN file to the stream
void cmGlobalVisualStudio7Generator void cmGlobalVisualStudio7Generator
::WriteSLNFile(std::ostream& fout, ::WriteSLNFile(std::ostream& fout,
@ -344,6 +387,13 @@ void cmGlobalVisualStudio7Generator
OrderedTargetDependSet orderedProjectTargets(projectTargets); OrderedTargetDependSet orderedProjectTargets(projectTargets);
this->WriteTargetsToSolution(fout, root, orderedProjectTargets); this->WriteTargetsToSolution(fout, root, orderedProjectTargets);
bool useFolderProperty = this->UseFolderProperty();
if (useFolderProperty)
{
this->WriteFolders(fout);
}
// Write out the configurations information for the solution // Write out the configurations information for the solution
fout << "Global\n" fout << "Global\n"
<< "\tGlobalSection(SolutionConfiguration) = preSolution\n"; << "\tGlobalSection(SolutionConfiguration) = preSolution\n";
@ -361,6 +411,14 @@ void cmGlobalVisualStudio7Generator
this->WriteTargetDepends(fout, orderedProjectTargets); this->WriteTargetDepends(fout, orderedProjectTargets);
fout << "\tEndGlobalSection\n"; fout << "\tEndGlobalSection\n";
if (useFolderProperty)
{
// Write out project folders
fout << "\tGlobalSection(NestedProjects) = preSolution\n";
this->WriteFoldersContent(fout);
fout << "\tEndGlobalSection\n";
}
// Write out the configurations for all the targets in the project // Write out the configurations for all the targets in the project
fout << "\tGlobalSection(ProjectConfiguration) = postSolution\n"; fout << "\tGlobalSection(ProjectConfiguration) = postSolution\n";
this->WriteTargetConfigurations(fout, root, orderedProjectTargets); this->WriteTargetConfigurations(fout, root, orderedProjectTargets);
@ -370,6 +428,47 @@ void cmGlobalVisualStudio7Generator
this->WriteSLNFooter(fout); this->WriteSLNFooter(fout);
} }
//----------------------------------------------------------------------------
void cmGlobalVisualStudio7Generator::WriteFolders(std::ostream& fout)
{
std::string guidProjectTypeFolder = "2150E333-8FDC-42A3-9474-1A3956D46DE8";
for(std::map<std::string,std::set<std::string> >::iterator iter =
VisualStudioFolders.begin(); iter != VisualStudioFolders.end(); ++iter)
{
std::string fullName = iter->first;
std::string guid = this->GetGUID(fullName.c_str());
std::string nameOnly = cmSystemTools::GetFilenameName(fullName);
cmSystemTools::ReplaceString(fullName, "/", "\\");
fout << "Project(\"{" <<
guidProjectTypeFolder << "}\") = \"" <<
nameOnly << "\", \"" <<
fullName << "\", \"{" <<
guid <<
"}\"\nEndProject\n";
}
}
//----------------------------------------------------------------------------
void cmGlobalVisualStudio7Generator::WriteFoldersContent(std::ostream& fout)
{
for(std::map<std::string,std::set<std::string> >::iterator iter =
VisualStudioFolders.begin(); iter != VisualStudioFolders.end(); ++iter)
{
std::string key(iter->first);
std::string guidParent(this->GetGUID(key.c_str()));
for(std::set<std::string>::iterator it = iter->second.begin();
it != iter->second.end(); ++it)
{
std::string value(*it);
std::string guid(this->GetGUID(value.c_str()));
fout << "\t\t{" << guid << "} = {" << guidParent << "}\n";
}
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string std::string
cmGlobalVisualStudio7Generator::ConvertToSolutionPath(const char* path) cmGlobalVisualStudio7Generator::ConvertToSolutionPath(const char* path)

View File

@ -142,6 +142,10 @@ protected:
std::vector<std::string> Configurations; std::vector<std::string> Configurations;
std::map<cmStdString, cmStdString> GUIDMap; std::map<cmStdString, cmStdString> GUIDMap;
virtual void WriteFolders(std::ostream& fout);
virtual void WriteFoldersContent(std::ostream& fout);
std::map<std::string,std::set<std::string> > VisualStudioFolders;
// Set during OutputSLNFile with the name of the current project. // Set during OutputSLNFile with the name of the current project.
// There is one SLN file per project. // There is one SLN file per project.
std::string CurrentProject; std::string CurrentProject;

View File

@ -136,6 +136,13 @@ void cmGlobalVisualStudio8Generator::AddCheckTarget()
no_working_directory, no_depends, no_working_directory, no_depends,
noCommandLines); noCommandLines);
// Organize in the "predefined targets" folder:
//
if (this->UseFolderProperty())
{
tgt->SetProperty("FOLDER", this->GetPredefinedTargetsFolder());
}
// Create a list of all stamp files for this project. // Create a list of all stamp files for this project.
std::vector<std::string> stamps; std::vector<std::string> stamps;
std::string stampList = cmake::GetCMakeFilesDirectoryPostSlash(); std::string stampList = cmake::GetCMakeFilesDirectoryPostSlash();

View File

@ -56,6 +56,21 @@ void cmGlobalVisualStudioGenerator::Generate()
AddUtilityCommand("ALL_BUILD", true, no_working_dir, AddUtilityCommand("ALL_BUILD", true, no_working_dir,
no_depends, no_commands, false, no_depends, no_commands, false,
"Build all projects"); "Build all projects");
#if 0
// Can't activate this code because we want ALL_BUILD
// selected as the default "startup project" when first
// opened in Visual Studio... And if it's nested in a
// folder, then that doesn't happen.
//
// Organize in the "predefined targets" folder:
//
if (this->UseFolderProperty())
{
allBuild->SetProperty("FOLDER", this->GetPredefinedTargetsFolder());
}
#endif
// Now make all targets depend on the ALL_BUILD target // Now make all targets depend on the ALL_BUILD target
cmTargets targets; cmTargets targets;
for(std::vector<cmLocalGenerator*>::iterator i = gen.begin(); for(std::vector<cmLocalGenerator*>::iterator i = gen.begin();

View File

@ -853,11 +853,20 @@ void cmTarget::DefineProperties(cmake *cm)
"The names returned are suitable for passing to the " "The names returned are suitable for passing to the "
"set_source_files_properties command."); "set_source_files_properties command.");
cm->DefineProperty
("FOLDER", cmProperty::TARGET,
"Set the folder name. Use to organize targets in an IDE.",
"Targets with no FOLDER property will appear as top level "
"entities in IDEs like Visual Studio. Targets with the same "
"FOLDER property value will appear next to each other in a "
"folder of that name. To nest folders, use FOLDER values such "
"as 'GUI/Dialogs' with '/' characters separating folder levels.");
cm->DefineProperty cm->DefineProperty
("PROJECT_LABEL", cmProperty::TARGET, ("PROJECT_LABEL", cmProperty::TARGET,
"Change the name of a target in an IDE.", "Change the name of a target in an IDE.",
"Can be used to change the name of the target in an IDE " "Can be used to change the name of the target in an IDE "
"like visual stuido. "); "like Visual Studio. ");
cm->DefineProperty cm->DefineProperty
("VS_KEYWORD", cmProperty::TARGET, ("VS_KEYWORD", cmProperty::TARGET,
"Visual Studio project keyword.", "Visual Studio project keyword.",

View File

@ -3483,6 +3483,23 @@ void cmake::DefineProperties(cmake *cm)
"the value of this property. " "the value of this property. "
"Non-Makefile generators currently ignore this property."); "Non-Makefile generators currently ignore this property.");
cm->DefineProperty
("USE_FOLDERS", cmProperty::GLOBAL,
"Use the FOLDER target property to organize targets into folders.",
"If not set, CMake treats this property as ON by default. "
"CMake generators that are capable of organizing into a "
"hierarchy of folders use the values of the FOLDER target "
"property to name those folders. See also the documentation "
"for the FOLDER target property.");
cm->DefineProperty
("PREDEFINED_TARGETS_FOLDER", cmProperty::GLOBAL,
"Name of FOLDER for targets that are added automatically by CMake.",
"If not set, CMake uses \"CMakePredefinedTargets\" as a default "
"value for this property. Targets such as INSTALL, PACKAGE and "
"RUN_TESTS will be organized into this FOLDER. See also the "
"documentation for the FOLDER target property.");
// ================================================================ // ================================================================
// define variables as well // define variables as well
// ================================================================ // ================================================================

View File

@ -7,6 +7,9 @@ find_package(CVS)
find_package(Subversion) find_package(Subversion)
find_package(Git) find_package(Git)
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER
"CMakePredefinedTargets-in-ExternalProjectTest")
set(base "${CMAKE_BINARY_DIR}/CMakeExternals") set(base "${CMAKE_BINARY_DIR}/CMakeExternals")
set(binary_base "${base}/Build") set(binary_base "${base}/Build")
set_property(DIRECTORY PROPERTY EP_BASE ${base}) set_property(DIRECTORY PROPERTY EP_BASE ${base})
@ -41,6 +44,22 @@ endif()
# Empty projects that test all the known ExternalProject_Add argument key words: # Empty projects that test all the known ExternalProject_Add argument key words:
# #
set(proj AAA-TestAlphabetization)
ExternalProject_Add(${proj}
BUILD_COMMAND ""
CONFIGURE_COMMAND ""
DOWNLOAD_COMMAND ""
INSTALL_COMMAND ""
)
set(proj ZZZ-TestAlphabetization)
ExternalProject_Add(${proj}
BUILD_COMMAND ""
CONFIGURE_COMMAND ""
DOWNLOAD_COMMAND ""
INSTALL_COMMAND ""
)
set(proj MinimalNoOpProject) set(proj MinimalNoOpProject)
ExternalProject_Add(${proj} ExternalProject_Add(${proj}
BUILD_COMMAND "" BUILD_COMMAND ""
@ -69,6 +88,7 @@ ExternalProject_Add(${proj}
URL_MD5 "" URL_MD5 ""
UPDATE_COMMAND "" UPDATE_COMMAND ""
) )
set_property(TARGET ${proj} PROPERTY FOLDER "")
# Local DIR: # Local DIR:
@ -80,6 +100,7 @@ if(can_build_tutorial_step5)
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR> CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR>
TEST_BEFORE_INSTALL 1 TEST_BEFORE_INSTALL 1
) )
set_property(TARGET ${proj} PROPERTY FOLDER "Local")
ExternalProject_Get_Property(${proj} install_dir) ExternalProject_Get_Property(${proj} install_dir)
set(TutorialStep5_install_dir ${install_dir}) set(TutorialStep5_install_dir ${install_dir})
@ -89,6 +110,7 @@ if(can_build_tutorial_step5)
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR> CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR>
TEST_AFTER_INSTALL 1 TEST_AFTER_INSTALL 1
) )
set_property(TARGET ${proj} PROPERTY FOLDER "Local")
endif() endif()
@ -105,6 +127,7 @@ ExternalProject_Add(${proj}
-DTEST_LIST:STRING=A::B::C -DTEST_LIST:STRING=A::B::C
INSTALL_COMMAND "" INSTALL_COMMAND ""
) )
set_property(TARGET ${proj} PROPERTY FOLDER "Local/TAR")
set(proj TutorialStep1-LocalNoDirTAR) set(proj TutorialStep1-LocalNoDirTAR)
ExternalProject_Add(${proj} ExternalProject_Add(${proj}
@ -115,6 +138,7 @@ ExternalProject_Add(${proj}
-DTEST_LIST:STRING=1@@2@@3 -DTEST_LIST:STRING=1@@2@@3
INSTALL_COMMAND "" INSTALL_COMMAND ""
) )
set_property(TARGET ${proj} PROPERTY FOLDER "Local/TAR")
ExternalProject_Add_Step(${proj} mypatch ExternalProject_Add_Step(${proj} mypatch
COMMAND ${CMAKE_COMMAND} -E echo "This is a custom external project step." COMMAND ${CMAKE_COMMAND} -E echo "This is a custom external project step."
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/Step1Patch.cmake COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/Step1Patch.cmake
@ -133,6 +157,7 @@ ExternalProject_Add(${proj}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR> CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR>
INSTALL_COMMAND "" INSTALL_COMMAND ""
) )
set_property(TARGET ${proj} PROPERTY FOLDER "Local/TGZ")
set(proj TutorialStep1-LocalNoDirTGZ) set(proj TutorialStep1-LocalNoDirTGZ)
ExternalProject_Add(${proj} ExternalProject_Add(${proj}
@ -142,6 +167,7 @@ ExternalProject_Add(${proj}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
INSTALL_COMMAND "" INSTALL_COMMAND ""
) )
set_property(TARGET ${proj} PROPERTY FOLDER "Local/TGZ")
# Local BZ2: # Local BZ2:
@ -158,6 +184,7 @@ ExternalProject_Add(${proj}
BUILD_COMMAND "" BUILD_COMMAND ""
INSTALL_COMMAND "" INSTALL_COMMAND ""
) )
set_property(TARGET ${proj} PROPERTY FOLDER "Local/BZ2")
set(proj TutorialStep1-LocalNoDirBZ2) set(proj TutorialStep1-LocalNoDirBZ2)
ExternalProject_Add(${proj} ExternalProject_Add(${proj}
@ -166,6 +193,7 @@ ExternalProject_Add(${proj}
BUILD_COMMAND "" BUILD_COMMAND ""
INSTALL_COMMAND "" INSTALL_COMMAND ""
) )
set_property(TARGET ${proj} PROPERTY FOLDER "Local/BZ2")
# Local ZIP: # Local ZIP:
@ -182,6 +210,7 @@ ExternalProject_Add(${proj}
BUILD_COMMAND "" BUILD_COMMAND ""
INSTALL_COMMAND "" INSTALL_COMMAND ""
) )
set_property(TARGET ${proj} PROPERTY FOLDER "Local/ZIP")
set(proj TutorialStep1-LocalNoDirZIP) set(proj TutorialStep1-LocalNoDirZIP)
ExternalProject_Add(${proj} ExternalProject_Add(${proj}
@ -190,6 +219,7 @@ ExternalProject_Add(${proj}
BUILD_COMMAND "" BUILD_COMMAND ""
INSTALL_COMMAND "" INSTALL_COMMAND ""
) )
set_property(TARGET ${proj} PROPERTY FOLDER "Local/ZIP")
# CVS-based tests: # CVS-based tests:
@ -221,6 +251,8 @@ if(do_cvs_tests)
CONFIGURE_COMMAND "${CVS_EXECUTABLE}" --version CONFIGURE_COMMAND "${CVS_EXECUTABLE}" --version
INSTALL_COMMAND "" INSTALL_COMMAND ""
) )
set_property(TARGET ${proj}
PROPERTY FOLDER "SetupRepos/Local/Deeply/Nested/For/Testing")
# CVS by date stamp: # CVS by date stamp:
# #
@ -235,6 +267,7 @@ if(do_cvs_tests)
INSTALL_COMMAND "" INSTALL_COMMAND ""
DEPENDS "SetupLocalCVSRepository" DEPENDS "SetupLocalCVSRepository"
) )
set_property(TARGET ${proj} PROPERTY FOLDER "CVS")
# CVS by tag: # CVS by tag:
# #
@ -249,6 +282,7 @@ if(do_cvs_tests)
INSTALL_COMMAND "" INSTALL_COMMAND ""
DEPENDS "SetupLocalCVSRepository" DEPENDS "SetupLocalCVSRepository"
) )
set_property(TARGET ${proj} PROPERTY FOLDER "CVS")
# Live CVS / HEAD (no CVS_TAG): # Live CVS / HEAD (no CVS_TAG):
# #
@ -268,6 +302,7 @@ if(do_cvs_tests)
DEPENDS "TutorialStep1-CVS-20090626" DEPENDS "TutorialStep1-CVS-20090626"
DEPENDS "TutorialStep1-CVS-testtag1" DEPENDS "TutorialStep1-CVS-testtag1"
) )
set_property(TARGET ${proj} PROPERTY FOLDER "CVS")
endif() endif()
@ -320,6 +355,8 @@ if(do_svn_tests)
CONFIGURE_COMMAND "${Subversion_SVN_EXECUTABLE}" --version CONFIGURE_COMMAND "${Subversion_SVN_EXECUTABLE}" --version
INSTALL_COMMAND "" INSTALL_COMMAND ""
) )
set_property(TARGET ${proj}
PROPERTY FOLDER "SetupRepos/Local/Deeply/Nested/For/Testing")
# SVN by date stamp: # SVN by date stamp:
# #
@ -333,6 +370,7 @@ if(do_svn_tests)
INSTALL_COMMAND "" INSTALL_COMMAND ""
DEPENDS "SetupLocalSVNRepository" DEPENDS "SetupLocalSVNRepository"
) )
set_property(TARGET ${proj} PROPERTY FOLDER "SVN")
# SVN by revision number: # SVN by revision number:
# #
@ -346,6 +384,7 @@ if(do_svn_tests)
INSTALL_COMMAND "" INSTALL_COMMAND ""
DEPENDS "SetupLocalSVNRepository" DEPENDS "SetupLocalSVNRepository"
) )
set_property(TARGET ${proj} PROPERTY FOLDER "SVN")
# Live SVN / trunk (no SVN_REVISION): # Live SVN / trunk (no SVN_REVISION):
# #
@ -357,6 +396,7 @@ if(do_svn_tests)
INSTALL_COMMAND "" INSTALL_COMMAND ""
DEPENDS "SetupLocalSVNRepository" DEPENDS "SetupLocalSVNRepository"
) )
set_property(TARGET ${proj} PROPERTY FOLDER "SVN")
endif() endif()
@ -394,6 +434,8 @@ if(do_git_tests)
CONFIGURE_COMMAND "${GIT_EXECUTABLE}" --version CONFIGURE_COMMAND "${GIT_EXECUTABLE}" --version
INSTALL_COMMAND "" INSTALL_COMMAND ""
) )
set_property(TARGET ${proj}
PROPERTY FOLDER "SetupRepos/Local/Deeply/Nested/For/Testing")
# git by commit id: # git by commit id:
# #
@ -407,6 +449,7 @@ if(do_git_tests)
INSTALL_COMMAND "" INSTALL_COMMAND ""
DEPENDS "SetupLocalGITRepository" DEPENDS "SetupLocalGITRepository"
) )
set_property(TARGET ${proj} PROPERTY FOLDER "GIT")
# git by explicit branch/tag name: # git by explicit branch/tag name:
# #
@ -420,6 +463,7 @@ if(do_git_tests)
INSTALL_COMMAND "" INSTALL_COMMAND ""
DEPENDS "SetupLocalGITRepository" DEPENDS "SetupLocalGITRepository"
) )
set_property(TARGET ${proj} PROPERTY FOLDER "GIT")
# Live git / master (no GIT_TAG): # Live git / master (no GIT_TAG):
# #
@ -431,6 +475,7 @@ if(do_git_tests)
INSTALL_COMMAND "" INSTALL_COMMAND ""
DEPENDS "SetupLocalGITRepository" DEPENDS "SetupLocalGITRepository"
) )
set_property(TARGET ${proj} PROPERTY FOLDER "GIT")
endif() endif()