Merge branch 'version'

This commit is contained in:
Brad King 2010-05-17 13:34:29 -04:00
commit 3ebb41d58a
16 changed files with 175 additions and 89 deletions

View File

@ -31,12 +31,7 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
SET(CPACK_PACKAGE_VERSION_MINOR "${CMake_VERSION_MINOR}") SET(CPACK_PACKAGE_VERSION_MINOR "${CMake_VERSION_MINOR}")
SET(CPACK_PACKAGE_VERSION_PATCH "${CMake_VERSION_PATCH}") SET(CPACK_PACKAGE_VERSION_PATCH "${CMake_VERSION_PATCH}")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME SET(CPACK_SOURCE_PACKAGE_FILE_NAME "cmake-${CMake_VERSION}")
"cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}")
IF(CMake_VERSION_RC)
SET(CPACK_SOURCE_PACKAGE_FILE_NAME
"${CPACK_SOURCE_PACKAGE_FILE_NAME}-rc${CMake_VERSION_RC}")
ENDIF(CMake_VERSION_RC)
IF(NOT DEFINED CPACK_SYSTEM_NAME) IF(NOT DEFINED CPACK_SYSTEM_NAME)
# make sure package is not Cygwin-unknown, for Cygwin just # make sure package is not Cygwin-unknown, for Cygwin just
# cygwin is good for the system name # cygwin is good for the system name
@ -88,7 +83,7 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
SET(CPACK_PACKAGE_NAME cmake) SET(CPACK_PACKAGE_NAME cmake)
# setup the name of the package for cygwin cmake-2.4.3 # setup the name of the package for cygwin cmake-2.4.3
SET(CPACK_PACKAGE_FILE_NAME SET(CPACK_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}") "${CPACK_PACKAGE_NAME}-${CMake_VERSION}")
# the source has the same name as the binary # the source has the same name as the binary
SET(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME}) SET(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME})
# Create a cygwin version number in case there are changes for cygwin # Create a cygwin version number in case there are changes for cygwin

View File

@ -339,18 +339,35 @@ ENDMACRO (CMAKE_BUILD_UTILITIES)
SET(CMake_VERSION_MAJOR 2) SET(CMake_VERSION_MAJOR 2)
SET(CMake_VERSION_MINOR 9) SET(CMake_VERSION_MINOR 9)
SET(CMake_VERSION_PATCH 0) SET(CMake_VERSION_PATCH 0)
#SET(CMake_VERSION_TWEAK 0)
# We use odd minor numbers for development versions. # Releases define a tweak level.
# Use a date for the development patch level. IF(DEFINED CMake_VERSION_TWEAK)
IF("${CMake_VERSION_MINOR}" MATCHES "[13579]$") SET(CMake_VERSION_IS_RELEASE 1)
SET(CMake_VERSION_SOURCE "")
ELSE()
SET(CMake_VERSION_IS_RELEASE 0)
# Use the date as the tweak level.
INCLUDE(${CMake_SOURCE_DIR}/Source/kwsys/kwsysDateStamp.cmake) INCLUDE(${CMake_SOURCE_DIR}/Source/kwsys/kwsysDateStamp.cmake)
SET(CMake_VERSION_PATCH SET(CMake_VERSION_TWEAK
"${KWSYS_DATE_STAMP_YEAR}${KWSYS_DATE_STAMP_MONTH}${KWSYS_DATE_STAMP_DAY}" "${KWSYS_DATE_STAMP_YEAR}${KWSYS_DATE_STAMP_MONTH}${KWSYS_DATE_STAMP_DAY}"
) )
ENDIF("${CMake_VERSION_MINOR}" MATCHES "[13579]$")
SET(CMake_VERSION "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") INCLUDE(${CMake_SOURCE_DIR}/Source/CMakeVersionSource.cmake)
SET(CMake_VERSION_FULL "${CMake_VERSION}.${CMake_VERSION_PATCH}") ENDIF()
# Compute the full version string.
SET(CMake_VERSION ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH})
IF(${CMake_VERSION_TWEAK} GREATER 0)
SET(CMake_VERSION ${CMake_VERSION}.${CMake_VERSION_TWEAK})
ENDIF()
IF(CMake_VERSION_RC)
SET(CMake_VERSION ${CMake_VERSION}-rc${CMake_VERSION_RC})
ENDIF()
IF(CMake_VERSION_SOURCE)
SET(CMake_VERSION ${CMake_VERSION}-${CMake_VERSION_SOURCE})
ENDIF()
# Include the standard Dart testing module # Include the standard Dart testing module
ENABLE_TESTING() ENABLE_TESTING()
@ -370,9 +387,9 @@ SET(LIBRARY_OUTPUT_PATH "" CACHE INTERNAL
# install tree. # install tree.
SET(CMAKE_SKIP_RPATH ON CACHE INTERNAL "CMake does not need RPATHs.") SET(CMAKE_SKIP_RPATH ON CACHE INTERNAL "CMake does not need RPATHs.")
SET(CMAKE_DATA_DIR "/share/cmake-${CMake_VERSION}" CACHE STRING SET(CMAKE_DATA_DIR "/share/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}" CACHE STRING
"Install location for data (relative to prefix).") "Install location for data (relative to prefix).")
SET(CMAKE_DOC_DIR "/doc/cmake-${CMake_VERSION}" CACHE STRING SET(CMAKE_DOC_DIR "/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}" CACHE STRING
"Install location for documentation (relative to prefix).") "Install location for documentation (relative to prefix).")
SET(CMAKE_MAN_DIR "/man" CACHE STRING SET(CMAKE_MAN_DIR "/man" CACHE STRING
"Install location for man pages (relative to prefix).") "Install location for man pages (relative to prefix).")

View File

@ -0,0 +1,37 @@
# Try to identify the current development source version.
set(CMake_VERSION_SOURCE "")
if(EXISTS ${CMake_SOURCE_DIR}/.git/HEAD)
find_program(GIT_EXECUTABLE NAMES git git.cmd)
mark_as_advanced(GIT_EXECUTABLE)
if(GIT_EXECUTABLE)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --verify -q --short=4 HEAD
OUTPUT_VARIABLE head
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${CMake_SOURCE_DIR}
)
if(head)
set(CMake_VERSION_SOURCE "g${head}")
execute_process(
COMMAND ${GIT_EXECUTABLE} update-index -q --refresh
WORKING_DIRECTORY ${CMake_SOURCE_DIR}
)
execute_process(
COMMAND ${GIT_EXECUTABLE} diff-index --name-only HEAD --
OUTPUT_VARIABLE dirty
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${CMake_SOURCE_DIR}
)
if(dirty)
set(CMake_VERSION_SOURCE "${CMake_VERSION_SOURCE}-dirty")
endif()
endif()
endif()
elseif(EXISTS ${CMake_SOURCE_DIR}/CVS/Repository)
file(READ ${CMake_SOURCE_DIR}/CVS/Repository repo)
set(branch "")
if("${repo}" MATCHES "\\.git/")
string(REGEX REPLACE ".*\\.git/([^\r\n]*).*" "-\\1" branch "${repo}")
endif()
set(CMake_VERSION_SOURCE "cvs${branch}")
endif()

View File

@ -66,14 +66,17 @@ bool cmCMakeMinimumRequired
int current_major = cmVersion::GetMajorVersion(); int current_major = cmVersion::GetMajorVersion();
int current_minor = cmVersion::GetMinorVersion(); int current_minor = cmVersion::GetMinorVersion();
int current_patch = cmVersion::GetPatchVersion(); int current_patch = cmVersion::GetPatchVersion();
int current_tweak = cmVersion::GetTweakVersion();
// Parse the required version number. If no patch-level is given // Parse at least two components of the version number.
// use zero. // Use zero for those not specified.
int required_major = 0; int required_major = 0;
int required_minor = 0; int required_minor = 0;
int required_patch = 0; int required_patch = 0;
if(sscanf(version_string.c_str(), "%d.%d.%d", int required_tweak = 0;
&required_major, &required_minor, &required_patch) < 2) if(sscanf(version_string.c_str(), "%u.%u.%u.%u",
&required_major, &required_minor,
&required_patch, &required_tweak) < 2)
{ {
cmOStringStream e; cmOStringStream e;
e << "could not parse VERSION \"" << version_string.c_str() << "\"."; e << "could not parse VERSION \"" << version_string.c_str() << "\".";
@ -87,13 +90,17 @@ bool cmCMakeMinimumRequired
current_minor < required_minor) || current_minor < required_minor) ||
(current_major == required_major && (current_major == required_major &&
current_minor == required_minor && current_minor == required_minor &&
current_patch < required_patch)) current_patch < required_patch) ||
(current_major == required_major &&
current_minor == required_minor &&
current_patch == required_patch &&
current_tweak < required_tweak))
{ {
// The current version is too low. // The current version is too low.
cmOStringStream e; cmOStringStream e;
e << "CMake " << version_string.c_str() e << "CMake " << version_string.c_str()
<< " or higher is required. You are running version " << " or higher is required. You are running version "
<< current_major << "." << current_minor << "." << current_patch; << cmVersion::GetCMakeVersion();
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
cmSystemTools::SetFatalErrorOccured(); cmSystemTools::SetFatalErrorOccured();
return true; return true;

View File

@ -61,13 +61,13 @@ public:
virtual const char* GetFullDocumentation() virtual const char* GetFullDocumentation()
{ {
return return
" cmake_minimum_required(VERSION major[.minor[.patch]]\n" " cmake_minimum_required(VERSION major[.minor[.patch[.tweak]]]\n"
" [FATAL_ERROR])\n" " [FATAL_ERROR])\n"
"If the current version of CMake is lower than that required " "If the current version of CMake is lower than that required "
"it will stop processing the project and report an error. " "it will stop processing the project and report an error. "
"When a version higher than 2.4 is specified the command implicitly " "When a version higher than 2.4 is specified the command implicitly "
"invokes\n" "invokes\n"
" cmake_policy(VERSION major[.minor[.patch]])\n" " cmake_policy(VERSION major[.minor[.patch[.tweak]]])\n"
"which sets the cmake policy version level to the version specified. " "which sets the cmake policy version level to the version specified. "
"When version 2.4 or lower is given the command implicitly invokes\n" "When version 2.4 or lower is given the command implicitly invokes\n"
" cmake_policy(VERSION 2.4)\n" " cmake_policy(VERSION 2.4)\n"

View File

@ -80,7 +80,7 @@ public:
"behavior. " "behavior. "
"While setting policies individually is supported, we encourage " "While setting policies individually is supported, we encourage "
"projects to set policies based on CMake versions.\n" "projects to set policies based on CMake versions.\n"
" cmake_policy(VERSION major.minor[.patch])\n" " cmake_policy(VERSION major.minor[.patch[.tweak]])\n"
"Specify that the current CMake list file is written for the " "Specify that the current CMake list file is written for the "
"given version of CMake. " "given version of CMake. "
"All policies introduced in the specified version or earlier " "All policies introduced in the specified version or earlier "

View File

@ -250,13 +250,23 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"This specifies the patch version of the CMake" "This specifies the patch version of the CMake"
" executable being run.",false, " executable being run.",false,
"Variables that Provide Information"); "Variables that Provide Information");
cm->DefineProperty
("CMAKE_TWEAK_VERSION", cmProperty::VARIABLE,
"The tweak version of cmake (i.e. the 1 in X.X.X.1).",
"This specifies the tweak version of the CMake executable being run. "
"Releases use tweak < 20000000 and development versions use the date "
"format CCYYMMDD for the tweak level."
,false, "Variables that Provide Information");
cm->DefineProperty cm->DefineProperty
("CMAKE_VERSION", cmProperty::VARIABLE, ("CMAKE_VERSION", cmProperty::VARIABLE,
"The full version of cmake in major.minor.patch format.", "The full version of cmake in major.minor.patch[.tweak[-id]] format.",
"This specifies the full version of the CMake executable being run. " "This specifies the full version of the CMake executable being run. "
"This variable is defined by versions 2.6.3 and higher. " "This variable is defined by versions 2.6.3 and higher. "
"See variables CMAKE_MAJOR_VERSION, CMAKE_MINOR_VERSION, and " "See variables CMAKE_MAJOR_VERSION, CMAKE_MINOR_VERSION, "
"CMAKE_PATCH_VERSION for individual version components.", false, "CMAKE_PATCH_VERSION, and CMAKE_TWEAK_VERSION "
"for individual version components. "
"The [-id] component appears in non-release versions "
"and may be arbitrary text.", false,
"Variables that Provide Information"); "Variables that Provide Information");
cm->DefineProperty cm->DefineProperty

View File

@ -2359,11 +2359,9 @@ void cmMakefile::AddDefaultDefinitions()
this->AddDefinition("CMAKE_MAJOR_VERSION", temp); this->AddDefinition("CMAKE_MAJOR_VERSION", temp);
sprintf(temp, "%d", cmVersion::GetPatchVersion()); sprintf(temp, "%d", cmVersion::GetPatchVersion());
this->AddDefinition("CMAKE_PATCH_VERSION", temp); this->AddDefinition("CMAKE_PATCH_VERSION", temp);
sprintf(temp, "%u.%u.%u", sprintf(temp, "%d", cmVersion::GetTweakVersion());
cmVersion::GetMajorVersion(), this->AddDefinition("CMAKE_TWEAK_VERSION", temp);
cmVersion::GetMinorVersion(), this->AddDefinition("CMAKE_VERSION", cmVersion::GetCMakeVersion());
cmVersion::GetPatchVersion());
this->AddDefinition("CMAKE_VERSION", temp);
this->AddDefinition("CMAKE_FILES_DIRECTORY", this->AddDefinition("CMAKE_FILES_DIRECTORY",
cmake::GetCMakeFilesDirectory()); cmake::GetCMakeFilesDirectory());

View File

@ -3,6 +3,7 @@
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmSourceFile.h" #include "cmSourceFile.h"
#include "cmVersion.h" #include "cmVersion.h"
#include "cmVersionMacros.h"
#include <map> #include <map>
#include <set> #include <set>
#include <queue> #include <queue>
@ -22,6 +23,7 @@ public:
unsigned int majorVersionIntroduced, unsigned int majorVersionIntroduced,
unsigned int minorVersionIntroduced, unsigned int minorVersionIntroduced,
unsigned int patchVersionIntroduced, unsigned int patchVersionIntroduced,
unsigned int tweakVersionIntroduced,
cmPolicies::PolicyStatus status) cmPolicies::PolicyStatus status)
{ {
if (!idString || !shortDescription || ! longDescription) if (!idString || !shortDescription || ! longDescription)
@ -37,21 +39,26 @@ public:
this->MajorVersionIntroduced = majorVersionIntroduced; this->MajorVersionIntroduced = majorVersionIntroduced;
this->MinorVersionIntroduced = minorVersionIntroduced; this->MinorVersionIntroduced = minorVersionIntroduced;
this->PatchVersionIntroduced = patchVersionIntroduced; this->PatchVersionIntroduced = patchVersionIntroduced;
this->TweakVersionIntroduced = tweakVersionIntroduced;
this->Status = status; this->Status = status;
} }
std::string GetVersionString() std::string GetVersionString()
{ {
cmOStringStream error; cmOStringStream v;
error << this->MajorVersionIntroduced << "." << v << this->MajorVersionIntroduced << "." << this->MinorVersionIntroduced;
this->MinorVersionIntroduced << "." << v << "." << this->PatchVersionIntroduced;
this->PatchVersionIntroduced; if(this->TweakVersionIntroduced > 0)
return error.str(); {
v << "." << this->TweakVersionIntroduced;
}
return v.str();
} }
bool IsPolicyNewerThan(unsigned int majorV, bool IsPolicyNewerThan(unsigned int majorV,
unsigned int minorV, unsigned int minorV,
unsigned int patchV) unsigned int patchV,
unsigned int tweakV)
{ {
if (majorV < this->MajorVersionIntroduced) if (majorV < this->MajorVersionIntroduced)
{ {
@ -69,7 +76,15 @@ public:
{ {
return false; return false;
} }
return (patchV < this->PatchVersionIntroduced); if (patchV < this->PatchVersionIntroduced)
{
return true;
}
if (patchV > this->PatchVersionIntroduced)
{
return false;
}
return (tweakV < this->TweakVersionIntroduced);
} }
cmPolicies::PolicyID ID; cmPolicies::PolicyID ID;
@ -79,6 +94,7 @@ public:
unsigned int MajorVersionIntroduced; unsigned int MajorVersionIntroduced;
unsigned int MinorVersionIntroduced; unsigned int MinorVersionIntroduced;
unsigned int PatchVersionIntroduced; unsigned int PatchVersionIntroduced;
unsigned int TweakVersionIntroduced;
cmPolicies::PolicyStatus Status; cmPolicies::PolicyStatus Status;
}; };
@ -110,7 +126,7 @@ cmPolicies::cmPolicies()
"The NEW behavior is to issue an error instead of a warning. " "The NEW behavior is to issue an error instead of a warning. "
"An included file may set CMP0000 explicitly to affect how this " "An included file may set CMP0000 explicitly to affect how this "
"policy is enforced for the main CMakeLists.txt file.", "policy is enforced for the main CMakeLists.txt file.",
2,6,0, cmPolicies::WARN 2,6,0,0, cmPolicies::WARN
); );
this->DefinePolicy( this->DefinePolicy(
@ -126,7 +142,7 @@ cmPolicies::cmPolicies()
"and the cmake_policy command. " "and the cmake_policy command. "
"However, CMake must still check CMAKE_BACKWARDS_COMPATIBILITY for " "However, CMake must still check CMAKE_BACKWARDS_COMPATIBILITY for "
"projects written for CMake 2.4 and below.", "projects written for CMake 2.4 and below.",
2,6,0, cmPolicies::WARN 2,6,0,0, cmPolicies::WARN
); );
this->DefinePolicy( this->DefinePolicy(
@ -148,7 +164,7 @@ cmPolicies::cmPolicies()
"Custom targets must simply have globally unique names (unless one " "Custom targets must simply have globally unique names (unless one "
"uses the global property ALLOW_DUPLICATE_CUSTOM_TARGETS with a " "uses the global property ALLOW_DUPLICATE_CUSTOM_TARGETS with a "
"Makefiles generator).", "Makefiles generator).",
2,6,0, cmPolicies::WARN 2,6,0,0, cmPolicies::WARN
); );
this->DefinePolicy( this->DefinePolicy(
@ -213,7 +229,7 @@ cmPolicies::cmPolicies()
"Note that the warning for this policy will be issued for at most " "Note that the warning for this policy will be issued for at most "
"one target. This avoids flooding users with messages for every " "one target. This avoids flooding users with messages for every "
"target when setting the policy once will probably fix all targets.", "target when setting the policy once will probably fix all targets.",
2,6,0, cmPolicies::WARN); 2,6,0,0, cmPolicies::WARN);
this->DefinePolicy( this->DefinePolicy(
CMP0004, "CMP0004", CMP0004, "CMP0004",
@ -229,7 +245,7 @@ cmPolicies::cmPolicies()
"The setting for this policy used when checking the library names is " "The setting for this policy used when checking the library names is "
"that in effect when the target is created by an add_executable or " "that in effect when the target is created by an add_executable or "
"add_library command.", "add_library command.",
2,6,0, cmPolicies::WARN); 2,6,0,0, cmPolicies::WARN);
this->DefinePolicy( this->DefinePolicy(
CMP0005, "CMP0005", CMP0005, "CMP0005",
@ -250,7 +266,7 @@ cmPolicies::cmPolicies()
"for all native build tools automatically. " "for all native build tools automatically. "
"See documentation of the COMPILE_DEFINITIONS target property for " "See documentation of the COMPILE_DEFINITIONS target property for "
"limitations of the escaping implementation.", "limitations of the escaping implementation.",
2,6,0, cmPolicies::WARN); 2,6,0,0, cmPolicies::WARN);
this->DefinePolicy( this->DefinePolicy(
CMP0006, "CMP0006", CMP0006, "CMP0006",
@ -268,7 +284,7 @@ cmPolicies::cmPolicies()
"DESTINATION if a BUNDLE DESTINATION is not given. " "DESTINATION if a BUNDLE DESTINATION is not given. "
"The NEW behavior for this policy is to produce an error if a bundle " "The NEW behavior for this policy is to produce an error if a bundle "
"target is installed without a BUNDLE DESTINATION.", "target is installed without a BUNDLE DESTINATION.",
2,6,0, cmPolicies::WARN); 2,6,0,0, cmPolicies::WARN);
this->DefinePolicy( this->DefinePolicy(
CMP0007, "CMP0007", CMP0007, "CMP0007",
@ -280,7 +296,7 @@ cmPolicies::cmPolicies()
"The OLD behavior for this policy is to ignore empty list elements. " "The OLD behavior for this policy is to ignore empty list elements. "
"The NEW behavior for this policy is to correctly count empty " "The NEW behavior for this policy is to correctly count empty "
"elements in a list. ", "elements in a list. ",
2,6,0, cmPolicies::WARN); 2,6,0,0, cmPolicies::WARN);
this->DefinePolicy( this->DefinePolicy(
CMP0008, "CMP0008", CMP0008, "CMP0008",
@ -306,7 +322,7 @@ cmPolicies::cmPolicies()
"path and ask the linker to search for it. " "path and ask the linker to search for it. "
"The NEW behavior for this policy is to trust the given path and " "The NEW behavior for this policy is to trust the given path and "
"pass it directly to the native build tool unchanged.", "pass it directly to the native build tool unchanged.",
2,6,1, cmPolicies::WARN); 2,6,1,0, cmPolicies::WARN);
this->DefinePolicy( this->DefinePolicy(
CMP0009, "CMP0009", CMP0009, "CMP0009",
@ -322,7 +338,7 @@ cmPolicies::cmPolicies()
"The NEW behavior for this policy is not to follow the symlinks " "The NEW behavior for this policy is not to follow the symlinks "
"by default, but only if FOLLOW_SYMLINKS is given as an additional " "by default, but only if FOLLOW_SYMLINKS is given as an additional "
"argument to the FILE command.", "argument to the FILE command.",
2,6,2, cmPolicies::WARN); 2,6,2,0, cmPolicies::WARN);
this->DefinePolicy( this->DefinePolicy(
CMP0010, "CMP0010", CMP0010, "CMP0010",
@ -334,7 +350,7 @@ cmPolicies::cmPolicies()
"The OLD behavior for this policy is to warn about the error, leave " "The OLD behavior for this policy is to warn about the error, leave "
"the string untouched, and continue. " "the string untouched, and continue. "
"The NEW behavior for this policy is to report an error.", "The NEW behavior for this policy is to report an error.",
2,6,3, cmPolicies::WARN); 2,6,3,0, cmPolicies::WARN);
this->DefinePolicy( this->DefinePolicy(
CMP0011, "CMP0011", CMP0011, "CMP0011",
@ -354,7 +370,7 @@ cmPolicies::cmPolicies()
"include() and find_package() commands. " "include() and find_package() commands. "
"The NEW behavior for this policy is to allow the commands to do their " "The NEW behavior for this policy is to allow the commands to do their "
"default cmake_policy PUSH and POP.", "default cmake_policy PUSH and POP.",
2,6,3, cmPolicies::WARN); 2,6,3,0, cmPolicies::WARN);
this->DefinePolicy( this->DefinePolicy(
CMP0012, "CMP0012", CMP0012, "CMP0012",
@ -376,7 +392,7 @@ cmPolicies::cmPolicies()
"named like numbers and boolean constants. " "named like numbers and boolean constants. "
"The NEW behavior for this policy is to recognize numbers and " "The NEW behavior for this policy is to recognize numbers and "
"boolean constants without dereferencing variables with such names.", "boolean constants without dereferencing variables with such names.",
2,8,0, cmPolicies::WARN); 2,8,0,0, cmPolicies::WARN);
this->DefinePolicy( this->DefinePolicy(
CMP0013, "CMP0013", CMP0013, "CMP0013",
@ -393,7 +409,7 @@ cmPolicies::cmPolicies()
"directories. " "directories. "
"The NEW behavior for this policy is to disallow duplicate binary " "The NEW behavior for this policy is to disallow duplicate binary "
"directories with an error.", "directories with an error.",
2,8,0, cmPolicies::WARN); 2,8,0,0, cmPolicies::WARN);
this->DefinePolicy( this->DefinePolicy(
CMP0014, "CMP0014", CMP0014, "CMP0014",
@ -405,7 +421,7 @@ cmPolicies::cmPolicies()
"the case is an error. " "the case is an error. "
"The OLD behavior for this policy is to silently ignore the problem. " "The OLD behavior for this policy is to silently ignore the problem. "
"The NEW behavior for this policy is to report an error.", "The NEW behavior for this policy is to report an error.",
2,8,0, cmPolicies::WARN); 2,8,0,0, cmPolicies::WARN);
this->DefinePolicy( this->DefinePolicy(
CMP0015, "CMP0015", CMP0015, "CMP0015",
@ -420,7 +436,7 @@ cmPolicies::cmPolicies()
"The NEW behavior for this policy is to convert relative paths to " "The NEW behavior for this policy is to convert relative paths to "
"absolute paths by appending the relative path to " "absolute paths by appending the relative path to "
"CMAKE_CURRENT_SOURCE_DIR.", "CMAKE_CURRENT_SOURCE_DIR.",
2,8,1, cmPolicies::WARN); 2,8,1,0, cmPolicies::WARN);
} }
cmPolicies::~cmPolicies() cmPolicies::~cmPolicies()
@ -441,6 +457,7 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD,
unsigned int majorVersionIntroduced, unsigned int majorVersionIntroduced,
unsigned int minorVersionIntroduced, unsigned int minorVersionIntroduced,
unsigned int patchVersionIntroduced, unsigned int patchVersionIntroduced,
unsigned int tweakVersionIntroduced,
cmPolicies::PolicyStatus status) cmPolicies::PolicyStatus status)
{ {
// a policy must be unique and can only be defined once // a policy must be unique and can only be defined once
@ -457,6 +474,7 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD,
majorVersionIntroduced, majorVersionIntroduced,
minorVersionIntroduced, minorVersionIntroduced,
patchVersionIntroduced, patchVersionIntroduced,
tweakVersionIntroduced,
status); status);
this->PolicyStringMap[idString] = iD; this->PolicyStringMap[idString] = iD;
} }
@ -475,14 +493,15 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
unsigned int majorVer = 2; unsigned int majorVer = 2;
unsigned int minorVer = 0; unsigned int minorVer = 0;
unsigned int patchVer = 0; unsigned int patchVer = 0;
unsigned int tweakVer = 0;
// parse the string // parse the string
if(sscanf(ver.c_str(), "%u.%u.%u", if(sscanf(ver.c_str(), "%u.%u.%u.%u",
&majorVer, &minorVer, &patchVer) < 2) &majorVer, &minorVer, &patchVer, &tweakVer) < 2)
{ {
cmOStringStream e; cmOStringStream e;
e << "Invalid policy version value \"" << ver << "\". " e << "Invalid policy version value \"" << ver << "\". "
<< "A numeric major.minor[.patch] must be given."; << "A numeric major.minor[.patch[.tweak]] must be given.";
mf->IssueMessage(cmake::FATAL_ERROR, e.str()); mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false; return false;
} }
@ -510,7 +529,11 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
minorVer > cmVersion::GetMinorVersion()) || minorVer > cmVersion::GetMinorVersion()) ||
(majorVer == cmVersion::GetMajorVersion() && (majorVer == cmVersion::GetMajorVersion() &&
minorVer == cmVersion::GetMinorVersion() && minorVer == cmVersion::GetMinorVersion() &&
patchVer > cmVersion::GetPatchVersion())) patchVer > cmVersion::GetPatchVersion()) ||
(majorVer == cmVersion::GetMajorVersion() &&
minorVer == cmVersion::GetMinorVersion() &&
patchVer == cmVersion::GetPatchVersion() &&
tweakVer > cmVersion::GetTweakVersion()))
{ {
cmOStringStream e; cmOStringStream e;
e << "An attempt was made to set the policy version of CMake to \"" e << "An attempt was made to set the policy version of CMake to \""
@ -528,7 +551,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
= this->Policies.begin(); = this->Policies.begin();
for (;i != this->Policies.end(); ++i) for (;i != this->Policies.end(); ++i)
{ {
if (i->second->IsPolicyNewerThan(majorVer,minorVer,patchVer)) if (i->second->IsPolicyNewerThan(majorVer,minorVer,patchVer,tweakVer))
{ {
if(i->second->Status == cmPolicies::REQUIRED_ALWAYS) if(i->second->Status == cmPolicies::REQUIRED_ALWAYS)
{ {

View File

@ -72,6 +72,7 @@ public:
unsigned int majorVersionIntroduced, unsigned int majorVersionIntroduced,
unsigned int minorVersionIntroduced, unsigned int minorVersionIntroduced,
unsigned int patchVersionIntroduced, unsigned int patchVersionIntroduced,
unsigned int tweakVersionIntroduced,
cmPolicies::PolicyStatus status); cmPolicies::PolicyStatus status);
///! Set a policy level for this listfile ///! Set a policy level for this listfile

View File

@ -16,8 +16,9 @@
unsigned int cmVersion::GetMajorVersion() { return CMake_VERSION_MAJOR; } unsigned int cmVersion::GetMajorVersion() { return CMake_VERSION_MAJOR; }
unsigned int cmVersion::GetMinorVersion() { return CMake_VERSION_MINOR; } unsigned int cmVersion::GetMinorVersion() { return CMake_VERSION_MINOR; }
unsigned int cmVersion::GetPatchVersion() { return CMake_VERSION_PATCH; } unsigned int cmVersion::GetPatchVersion() { return CMake_VERSION_PATCH; }
unsigned int cmVersion::GetTweakVersion() { return CMake_VERSION_TWEAK; }
const char* cmVersion::GetCMakeVersion() const char* cmVersion::GetCMakeVersion()
{ {
return CMake_VERSION_FULL CMake_VERSION_RC_SUFFIX; return CMake_VERSION;
} }

View File

@ -28,6 +28,7 @@ public:
static unsigned int GetMajorVersion(); static unsigned int GetMajorVersion();
static unsigned int GetMinorVersion(); static unsigned int GetMinorVersion();
static unsigned int GetPatchVersion(); static unsigned int GetPatchVersion();
static unsigned int GetTweakVersion();
static const char* GetCMakeVersion(); static const char* GetCMakeVersion();
}; };

View File

@ -12,4 +12,5 @@
#define CMake_VERSION_MAJOR @CMake_VERSION_MAJOR@ #define CMake_VERSION_MAJOR @CMake_VERSION_MAJOR@
#define CMake_VERSION_MINOR @CMake_VERSION_MINOR@ #define CMake_VERSION_MINOR @CMake_VERSION_MINOR@
#define CMake_VERSION_PATCH @CMake_VERSION_PATCH@ #define CMake_VERSION_PATCH @CMake_VERSION_PATCH@
#cmakedefine CMake_VERSION_RC @CMake_VERSION_RC@ #define CMake_VERSION_TWEAK @CMake_VERSION_TWEAK@
#define CMake_VERSION "@CMake_VERSION@"

View File

@ -14,22 +14,9 @@
#include "cmVersionConfig.h" #include "cmVersionConfig.h"
#define CMAKE_TO_STRING(x) CMAKE_TO_STRING0(x) #define CMake_VERSION_TWEAK_IS_RELEASE(tweak) ((tweak) < 20000000)
#define CMAKE_TO_STRING0(x) #x #if CMake_VERSION_TWEAK_IS_RELEASE(CMake_VERSION_TWEAK)
# define CMake_VERSION_IS_RELEASE 1
#define CMake_VERSION \
CMAKE_TO_STRING(CMake_VERSION_MAJOR) "." \
CMAKE_TO_STRING(CMake_VERSION_MINOR)
#define CMake_VERSION_FULL \
CMAKE_TO_STRING(CMake_VERSION_MAJOR) "." \
CMAKE_TO_STRING(CMake_VERSION_MINOR) "." \
CMAKE_TO_STRING(CMake_VERSION_PATCH)
#if !(CMake_VERSION_MINOR & 1) && defined(CMake_VERSION_RC)
# define CMake_VERSION_RC_SUFFIX "-rc" CMAKE_TO_STRING(CMake_VERSION_RC)
#else
# define CMake_VERSION_RC_SUFFIX ""
#endif #endif
#endif #endif

View File

@ -232,4 +232,5 @@ TRY_COMPILE(EXPORTER_COMPILED
MESSAGE(STATUS "Searching for export(PACKAGE) test project") MESSAGE(STATUS "Searching for export(PACKAGE) test project")
SET(CMakeTestExportPackage_DIR "" CACHE FILEPATH SET(CMakeTestExportPackage_DIR "" CACHE FILEPATH
"Wipe out find results for testing." FORCE) "Wipe out find results for testing." FORCE)
FIND_PACKAGE(CMakeTestExportPackage 1.${CMAKE_VERSION} EXACT REQUIRED) STRING(REGEX REPLACE "-.*$" "" version ${CMAKE_VERSION})
FIND_PACKAGE(CMakeTestExportPackage 1.${version} EXACT REQUIRED)

View File

@ -30,17 +30,22 @@ cmake_date_stamp_component()
cmake_system=`uname` cmake_system=`uname`
cmake_source_dir=`cd "\`dirname \"$0\"\`";pwd` cmake_source_dir=`cd "\`dirname \"$0\"\`";pwd`
cmake_binary_dir=`pwd` cmake_binary_dir=`pwd`
# Load version information.
cmake_version_major="`cmake_version_component MAJOR`" cmake_version_major="`cmake_version_component MAJOR`"
cmake_version_minor="`cmake_version_component MINOR`" cmake_version_minor="`cmake_version_component MINOR`"
if echo "${cmake_version_minor}" | grep "[0-9]*[13579]" > /dev/null 2>&1; then
cmake_version_patch="`cmake_date_stamp_component YEAR``cmake_date_stamp_component MONTH``cmake_date_stamp_component DAY`"
else
cmake_version_patch="`cmake_version_component PATCH`" cmake_version_patch="`cmake_version_component PATCH`"
cmake_version="${cmake_version_major}.${cmake_version_minor}.${cmake_version_patch}"
cmake_version_tweak="`cmake_version_component TWEAK`"
if [ "x$cmake_version_tweak" = "x" ]; then
cmake_version_tweak="`cmake_date_stamp_component YEAR``cmake_date_stamp_component MONTH``cmake_date_stamp_component DAY`"
fi fi
cmake_version="${cmake_version_major}.${cmake_version_minor}" if [ "$cmake_version_tweak" != "0" ]; then
cmake_version_full="${cmake_version_major}.${cmake_version_minor}.${cmake_version_patch}" cmake_version="${cmake_version}.${cmake_version_tweak}"
cmake_data_dir="/share/cmake-${cmake_version}" fi
cmake_doc_dir="/doc/cmake-${cmake_version}"
cmake_data_dir="/share/cmake-${cmake_version_major}.${cmake_version_minor}"
cmake_doc_dir="/doc/cmake-${cmake_version_major}.${cmake_version_minor}"
cmake_man_dir="/man" cmake_man_dir="/man"
cmake_init_file="" cmake_init_file=""
cmake_bootstrap_system_libs="" cmake_bootstrap_system_libs=""
@ -312,7 +317,7 @@ Directory and file names:
# Display CMake bootstrap usage # Display CMake bootstrap usage
cmake_version_display() cmake_version_display()
{ {
echo "CMake ${cmake_version_full}, Copyright 2000-2009 Kitware, Inc." echo "CMake ${cmake_version}, Copyright 2000-2009 Kitware, Inc."
} }
# Display CMake bootstrap error, display the log file and exit # Display CMake bootstrap error, display the log file and exit
@ -1246,6 +1251,8 @@ fi
cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MAJOR ${cmake_version_major}" cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MAJOR ${cmake_version_major}"
cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MINOR ${cmake_version_minor}" cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MINOR ${cmake_version_minor}"
cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_PATCH ${cmake_version_patch}" cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_PATCH ${cmake_version_patch}"
cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_TWEAK ${cmake_version_tweak}"
cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION \"${cmake_version}\""
cmake_report cmConfigure.h${_tmp} "#define CMAKE_ROOT_DIR \"${cmake_root_dir}\"" cmake_report cmConfigure.h${_tmp} "#define CMAKE_ROOT_DIR \"${cmake_root_dir}\""
cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"${cmake_data_dir}\"" cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"${cmake_data_dir}\""
cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP" cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP"