summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-02-14 16:58:32 (GMT)
committerBrad King <brad.king@kitware.com>2008-02-14 16:58:32 (GMT)
commit5b02a4a864d2e68c683be6275709ce3e38d51fee (patch)
tree70b57c336d56db5afe08acfb7ab0ed4aa84c5b1b
parent8375bb4768f29f595c66140b77dd6b01713afb79 (diff)
downloadCMake-5b02a4a864d2e68c683be6275709ce3e38d51fee.zip
CMake-5b02a4a864d2e68c683be6275709ce3e38d51fee.tar.gz
CMake-5b02a4a864d2e68c683be6275709ce3e38d51fee.tar.bz2
ENH: Re-enable diagnosis of non-unique target names.
- Re-enable enforcement in cmMakefile::EnforceUniqueName - Improve error message to help user resolve the problem - Fix Modules/CTestTargets.cmake to not duplicate testing targets - Move commands used by the changes to Modules/CTestTargets.cmake to build during bootstrap: DEFINE_PROPERTY, GET_PROPERTY
-rw-r--r--Modules/CTestTargets.cmake55
-rw-r--r--Source/cmBootstrapCommands.cxx4
-rw-r--r--Source/cmCommands.cxx4
-rw-r--r--Source/cmMakefile.cxx9
4 files changed, 37 insertions, 35 deletions
diff --git a/Modules/CTestTargets.cmake b/Modules/CTestTargets.cmake
index bb4cdee..dc8b876 100644
--- a/Modules/CTestTargets.cmake
+++ b/Modules/CTestTargets.cmake
@@ -35,32 +35,35 @@ IF(CMAKE_CONFIGURATION_TYPES)
SET(__conf_types -C "${CMAKE_CFG_INTDIR}")
ENDIF(CMAKE_CONFIGURATION_TYPES)
-# add testing targets
-IF(${CMAKE_MAKE_PROGRAM} MATCHES make)
- FOREACH(mode Experimental Nightly Continuous NightlyMemoryCheck)
- ADD_CUSTOM_TARGET(${mode} ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode})
- ENDFOREACH(mode)
-ELSE(${CMAKE_MAKE_PROGRAM} MATCHES make)
- # for IDE only add them once for nested projects
- IF (NOT DART_COMMON_TARGETS_ADDED)
- FOREACH(mode Experimental Nightly Continuous NightlyMemoryCheck)
- ADD_CUSTOM_TARGET(${mode} ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode})
- ENDFOREACH(mode)
- SET (DART_COMMON_TARGETS_ADDED 1)
- ENDIF (NOT DART_COMMON_TARGETS_ADDED)
-ENDIF(${CMAKE_MAKE_PROGRAM} MATCHES make)
+# Add convenience targets. Do this at most once in case of nested
+# projects.
+DEFINE_PROPERTY(CTEST_TARGETS_ADDED GLOBAL
+ "Internal property used by CTestTargets module."
+ "Set by the CTestTargets module to track addition of testing targets."
+ FALSE)
+GET_PROPERTY(_CTEST_TARGETS_ADDED GLOBAL PROPERTY CTEST_TARGETS_ADDED)
+IF(NOT _CTEST_TARGETS_ADDED)
+ SET_PROPERTY(GLOBAL PROPERTY CTEST_TARGETS_ADDED 1)
-
-# for non IDE based builds nmake and make
-# add all these extra targets
-IF(${CMAKE_MAKE_PROGRAM} MATCHES make)
- # Make targets for Experimental builds
- FOREACH(mode Nightly Experimental Continuous)
- FOREACH(testtype Start Update Configure Build Test Coverage MemCheck Submit)
- # missing purify
- ADD_CUSTOM_TARGET(${mode}${testtype}
- ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}${testtype})
- ENDFOREACH(testtype)
+ # For all generators add basic testing targets.
+ FOREACH(mode Experimental Nightly Continuous NightlyMemoryCheck)
+ ADD_CUSTOM_TARGET(${mode}
+ ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}
+ )
ENDFOREACH(mode)
-ENDIF (${CMAKE_MAKE_PROGRAM} MATCHES make)
+ # For Makefile generators add more granular targets.
+ IF("${CMAKE_GENERATOR}" MATCHES Make)
+ # Make targets for Experimental builds
+ FOREACH(mode Nightly Experimental Continuous)
+ FOREACH(testtype
+ Start Update Configure Build Test Coverage MemCheck Submit
+ # missing purify
+ )
+ ADD_CUSTOM_TARGET(${mode}${testtype}
+ ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}${testtype}
+ )
+ ENDFOREACH(testtype)
+ ENDFOREACH(mode)
+ ENDIF("${CMAKE_GENERATOR}" MATCHES Make)
+ENDIF(NOT _CTEST_TARGETS_ADDED)
diff --git a/Source/cmBootstrapCommands.cxx b/Source/cmBootstrapCommands.cxx
index 197ee2b..af9bf3d 100644
--- a/Source/cmBootstrapCommands.cxx
+++ b/Source/cmBootstrapCommands.cxx
@@ -34,6 +34,7 @@
#include "cmConfigureFileCommand.cxx"
#include "cmCoreTryCompile.cxx"
#include "cmCreateTestSourceList.cxx"
+#include "cmDefinePropertyCommand.cxx"
#include "cmElseCommand.cxx"
#include "cmEnableTestingCommand.cxx"
#include "cmEndForEachCommand.cxx"
@@ -56,6 +57,7 @@
#include "cmGetCMakePropertyCommand.cxx"
#include "cmGetDirectoryPropertyCommand.cxx"
#include "cmGetFilenameComponentCommand.cxx"
+#include "cmGetPropertyCommand.cxx"
#include "cmGetSourceFilePropertyCommand.cxx"
#include "cmGetTargetPropertyCommand.cxx"
#include "cmHexFileConverter.cxx"
@@ -103,6 +105,7 @@ void GetBootstrapCommands(std::list<cmCommand*>& commands)
commands.push_back(new cmCMakeMinimumRequired);
commands.push_back(new cmConfigureFileCommand);
commands.push_back(new cmCreateTestSourceList);
+ commands.push_back(new cmDefinePropertyCommand);
commands.push_back(new cmElseCommand);
commands.push_back(new cmEnableTestingCommand);
commands.push_back(new cmEndForEachCommand);
@@ -122,6 +125,7 @@ void GetBootstrapCommands(std::list<cmCommand*>& commands)
commands.push_back(new cmGetCMakePropertyCommand);
commands.push_back(new cmGetDirectoryPropertyCommand);
commands.push_back(new cmGetFilenameComponentCommand);
+ commands.push_back(new cmGetPropertyCommand);
commands.push_back(new cmGetSourceFilePropertyCommand);
commands.push_back(new cmGetTargetPropertyCommand);
commands.push_back(new cmIfCommand);
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index ff733eb..42ec776 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -18,14 +18,12 @@
#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cmAuxSourceDirectoryCommand.cxx"
#include "cmBuildNameCommand.cxx"
-#include "cmDefinePropertyCommand.cxx"
#include "cmElseIfCommand.cxx"
#include "cmEnableLanguageCommand.cxx"
#include "cmEndWhileCommand.cxx"
#include "cmExportCommand.cxx"
#include "cmExportLibraryDependencies.cxx"
#include "cmFLTKWrapUICommand.cxx"
-#include "cmGetPropertyCommand.cxx"
#include "cmGetTestPropertyCommand.cxx"
#include "cmIncludeExternalMSProjectCommand.cxx"
#include "cmInstallCommand.cxx"
@@ -64,14 +62,12 @@ void GetPredefinedCommands(std::list<cmCommand*>&
#if defined(CMAKE_BUILD_WITH_CMAKE)
commands.push_back(new cmAuxSourceDirectoryCommand);
commands.push_back(new cmBuildNameCommand);
- commands.push_back(new cmDefinePropertyCommand);
commands.push_back(new cmElseIfCommand);
commands.push_back(new cmEnableLanguageCommand);
commands.push_back(new cmEndWhileCommand);
commands.push_back(new cmExportCommand);
commands.push_back(new cmExportLibraryDependenciesCommand);
commands.push_back(new cmFLTKWrapUICommand);
- commands.push_back(new cmGetPropertyCommand);
commands.push_back(new cmGetTestPropertyCommand);
commands.push_back(new cmIncludeExternalMSProjectCommand);
commands.push_back(new cmInstallCommand);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 5834d53..35b0aea 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3156,7 +3156,6 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg)
msg = e.str();
return false;
}
-#if 0 /* disable until CTestTargets can be fixed */
else if(!this->NeedBackwardsCompatibility(2, 4))
{
// The conflict is with a non-imported target. Produce an error
@@ -3165,9 +3164,10 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg)
e << "cannot create target \"" << name
<< "\" because another target with the same name already exists. "
<< "Logical target names must be globally unique. "
- << "Consider using the OUTPUT_NAME target property to create "
- << "two targets with the same physical name while keeping logical "
- << "names distinct.\n"
+ << "For executables and libraries, consider using the OUTPUT_NAME "
+ << "target property to create two targets with the same physical "
+ << "name while keeping logical names distinct. "
+ << "Custom targets must simply have globally unique names.\n"
<< "If you are building an older project it is possible that "
<< "it violated this rule but was working accidentally. "
<< "Set CMAKE_BACKWARDS_COMPATIBILITY to 2.4 or lower to disable "
@@ -3175,7 +3175,6 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg)
msg = e.str();
return false;
}
-#endif
}
return true;
}