ENH: Centralized setting of CMake version number to top-level CMake listfile.

This commit is contained in:
Brad King 2003-02-13 21:57:05 -05:00
parent 170fe935d2
commit 1fe42129d4
10 changed files with 92 additions and 30 deletions

View File

@ -1,5 +1,12 @@
PROJECT(CMake) PROJECT(CMake)
# The CMake version number.
SET(CMake_VERSION_MAJOR 1)
SET(CMake_VERSION_MINOR 7)
SET(CMake_VERSION_PATCH 0)
SET(CMake_VERSION_STRING
"${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}")
IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.4) IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.4)
IF(CMAKE_GENERATOR MATCHES "Visual Studio 7") IF(CMAKE_GENERATOR MATCHES "Visual Studio 7")
SET(CMAKE_SKIP_COMPATIBILITY_TESTS 1) SET(CMAKE_SKIP_COMPATIBILITY_TESTS 1)

View File

@ -309,8 +309,6 @@ IF(BUILD_TESTING)
ENDIF (APPLE) ENDIF (APPLE)
ENDIF(BUILD_TESTING) ENDIF(BUILD_TESTING)
INCLUDE (${CMAKE_BINARY_DIR}/Source/LocalUserOptions.cmake OPTIONAL) INCLUDE (${CMAKE_BINARY_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
INCLUDE (${CMAKE_SOURCE_DIR}/Source/LocalUserOptions.cmake OPTIONAL) INCLUDE (${CMAKE_SOURCE_DIR}/Source/LocalUserOptions.cmake OPTIONAL)

View File

@ -29,12 +29,12 @@ IF ( CMAKE_WX_CAN_COMPILE )
IF(APPLE) IF(APPLE)
SET(APPLE_GUI_EXECUTABLE wxCMakeSetup) SET(APPLE_GUI_EXECUTABLE wxCMakeSetup)
SET(APPLE_GUI_INFO_STRING "CMake version 1.7.0, (c) 2003 Kitware Inc.") SET(APPLE_GUI_INFO_STRING "CMake version ${CMake_VERSION_MAJOR}, (c) 2003 Kitware Inc.")
SET(APPLE_GUI_IDENTIFIER "com.kitware.wxCMakeSetup") SET(APPLE_GUI_IDENTIFIER "com.kitware.wxCMakeSetup")
SET(APPLE_GUI_LONG_VERSION_STRING "1.7.0, (c) 2003 Kitware Inc.") SET(APPLE_GUI_LONG_VERSION_STRING "${CMake_VERSION_MAJOR}, (c) 2003 Kitware Inc.")
SET(APPLE_GUI_BUNDLE_NAME "CMake") SET(APPLE_GUI_BUNDLE_NAME "CMake")
SET(APPLE_GUI_SHORT_VERSION_STRING "1.7.0") SET(APPLE_GUI_SHORT_VERSION_STRING "${CMake_VERSION_MAJOR}")
SET(APPLE_GUI_BUNDLE_VERSION "1.7.0") SET(APPLE_GUI_BUNDLE_VERSION "${CMake_VERSION_MAJOR}")
SET(APPLE_GUI_ICON "CMakeIcon.icns") SET(APPLE_GUI_ICON "CMakeIcon.icns")
SET(APPLE_GUI_COPYRIGHT "Copyright 2002 Kitware Inc.") SET(APPLE_GUI_COPYRIGHT "Copyright 2002 Kitware Inc.")
CONFIGURE_FILE(${CMake_SOURCE_DIR}/Templates/AppleInfo.plist CONFIGURE_FILE(${CMake_SOURCE_DIR}/Templates/AppleInfo.plist

View File

@ -6,5 +6,6 @@
#define CMAKE_BUILD_DIR "${CMake_BINARY_DIR}" #define CMAKE_BUILD_DIR "${CMake_BINARY_DIR}"
#define CMAKE_PREFIX "${CMAKE_INSTALL_PREFIX}" #define CMAKE_PREFIX "${CMAKE_INSTALL_PREFIX}"
#define CMake_VERSION_MAJOR @CMake_VERSION_MAJOR@
#define CMake_VERSION_MINOR @CMake_VERSION_MINOR@
#define CMake_VERSION_PATCH @CMake_VERSION_PATCH@

View File

@ -3,3 +3,6 @@
#undef CMAKE_NO_ANSI_STRING_STREAM #undef CMAKE_NO_ANSI_STRING_STREAM
#undef CMAKE_NO_ANSI_FOR_SCOPE #undef CMAKE_NO_ANSI_FOR_SCOPE
#undef CMake_VERSION_MAJOR
#undef CMake_VERSION_MINOR
#undef CMake_VERSION_PATCH

View File

@ -57,6 +57,15 @@ cmMakefile::cmMakefile()
this->AddDefaultDefinitions(); this->AddDefaultDefinitions();
} }
const char* cmMakefile::GetReleaseVersion()
{
#if CMake_VERSION_MINOR & 1
return "development";
#else
return "patch " CMAKE_TO_STRING(CMake_VERSION_PATCH);
#endif
}
unsigned int cmMakefile::GetCacheMajorVersion() unsigned int cmMakefile::GetCacheMajorVersion()
{ {
if(!this->GetCacheManager()->GetCacheValue("CMAKE_CACHE_MAJOR_VERSION")) if(!this->GetCacheManager()->GetCacheValue("CMAKE_CACHE_MAJOR_VERSION"))

View File

@ -46,9 +46,9 @@ public:
/** /**
* Return major and minor version numbers for cmake. * Return major and minor version numbers for cmake.
*/ */
static unsigned int GetMajorVersion() { return 1;} static unsigned int GetMajorVersion() { return CMake_VERSION_MAJOR; }
static unsigned int GetMinorVersion() { return 7;} static unsigned int GetMinorVersion() { return CMake_VERSION_MINOR; }
static const char *GetReleaseVersion() { return "development";} static const char* GetReleaseVersion();
/** /**
* Return the major and minor version of the cmake that * Return the major and minor version of the cmake that

View File

@ -21,12 +21,20 @@
#ifndef cmStandardIncludes_h #ifndef cmStandardIncludes_h
#define cmStandardIncludes_h #define cmStandardIncludes_h
#define CMAKE_TO_STRING(x) CMAKE_TO_STRING0(x)
#define CMAKE_TO_STRING0(x) #x
// include configure generated header to define // include configure generated header to define
// CMAKE_NO_ANSI_STREAM_HEADERS and CMAKE_NO_STD_NAMESPACE // CMAKE_NO_ANSI_STREAM_HEADERS and CMAKE_NO_STD_NAMESPACE
#if defined(CMAKE_HAS_AUTOCONF) || defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_HAS_AUTOCONF) || defined(CMAKE_BUILD_WITH_CMAKE)
#include "cmConfigure.h" #include "cmConfigure.h"
#endif #endif
#define CMake_VERSION_STRING \
CMAKE_TO_STRING(CMake_VERSION_MAJOR) "." \
CMAKE_TO_STRING(CMake_VERSION_MINOR) "." \
CMAKE_TO_STRING(CMake_VERSION_PATCH)
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning ( disable : 4786 ) #pragma warning ( disable : 4786 )
#pragma warning ( disable : 4503 ) #pragma warning ( disable : 4503 )

62
configure vendored
View File

@ -953,13 +953,34 @@ CXXFLAGS=$save_CXXFLAGS
# Parse the cmake version number out of the top-level CMake listfile.
CMake_VERSION_MAJOR=`cat $fullSrcDir/CMakeLists.txt | sed -n '/SET *( *CMake_VERSION_MAJOR/ {s/.*MAJOR *\([0-9][0-9]*\).*/\1/;p;}'`
CMake_VERSION_MINOR=`cat $fullSrcDir/CMakeLists.txt | sed -n '/SET *( *CMake_VERSION_MINOR/ {s/.*MINOR *\([0-9][0-9]*\).*/\1/;p;}'`
CMake_VERSION_PATCH=`cat $fullSrcDir/CMakeLists.txt | sed -n '/SET *( *CMake_VERSION_PATCH/ {s/.*PATCH *\([0-9][0-9]*\).*/\1/;p;}'`
cat >> confdefs.h <<EOF
#define CMake_VERSION_MAJOR ${CMake_VERSION_MAJOR}
EOF
cat >> confdefs.h <<EOF
#define CMake_VERSION_MINOR ${CMake_VERSION_MINOR}
EOF
cat >> confdefs.h <<EOF
#define CMake_VERSION_PATCH ${CMake_VERSION_PATCH}
EOF
# Step 1: set the variable "system" to hold the name and version number # Step 1: set the variable "system" to hold the name and version number
# for the system. This can usually be done via the "uname" command, but # for the system. This can usually be done via the "uname" command, but
# there are a few systems, like Next, where this doesn't work. # there are a few systems, like Next, where this doesn't work.
echo $ac_n "checking system version (for dynamic loading)""... $ac_c" 1>&6 echo $ac_n "checking system version (for dynamic loading)""... $ac_c" 1>&6
echo "configure:963: checking system version (for dynamic loading)" >&5 echo "configure:984: checking system version (for dynamic loading)" >&5
if test -f /usr/lib/NextStep/software_version; then if test -f /usr/lib/NextStep/software_version; then
system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version` system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
else else
@ -998,9 +1019,9 @@ case $system in
CFLAGS_ORIG="$FLAGS" CFLAGS_ORIG="$FLAGS"
CFLAGS="-Aa $CFLAGS" CFLAGS="-Aa $CFLAGS"
echo $ac_n "checking whether ${CC} accepts -Aa""... $ac_c" 1>&6 echo $ac_n "checking whether ${CC} accepts -Aa""... $ac_c" 1>&6
echo "configure:1002: checking whether ${CC} accepts -Aa" >&5 echo "configure:1023: checking whether ${CC} accepts -Aa" >&5
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1004 "configure" #line 1025 "configure"
#include "confdefs.h" #include "confdefs.h"
void foo() {} void foo() {}
@ -1009,7 +1030,7 @@ int main() {
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1013: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:1034: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
@ -1042,7 +1063,7 @@ rm -f conftest*
CXXFLAGS_ORIG="$CXXFLAGS" CXXFLAGS_ORIG="$CXXFLAGS"
CXXFLAGS="-std strict_ansi -nopure_cname $CXXFLAGS" CXXFLAGS="-std strict_ansi -nopure_cname $CXXFLAGS"
echo $ac_n "checking whether ${CXX} accepts -std strict_ansi -nopure_cname""... $ac_c" 1>&6 echo $ac_n "checking whether ${CXX} accepts -std strict_ansi -nopure_cname""... $ac_c" 1>&6
echo "configure:1046: checking whether ${CXX} accepts -std strict_ansi -nopure_cname" >&5 echo "configure:1067: checking whether ${CXX} accepts -std strict_ansi -nopure_cname" >&5
ac_ext=C ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@ -1052,7 +1073,7 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
cross_compiling=$ac_cv_prog_cxx_cross cross_compiling=$ac_cv_prog_cxx_cross
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1056 "configure" #line 1077 "configure"
#include "confdefs.h" #include "confdefs.h"
void foo() {} void foo() {}
@ -1061,7 +1082,7 @@ int main() {
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1065: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:1086: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
@ -1096,7 +1117,7 @@ if test $ac_cv_prog_gxx = no; then
CXXFLAGS_ORIG="$CXXFLAGS" CXXFLAGS_ORIG="$CXXFLAGS"
CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS" CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
echo $ac_n "checking ansi standard C++ stream headers ""... $ac_c" 1>&6 echo $ac_n "checking ansi standard C++ stream headers ""... $ac_c" 1>&6
echo "configure:1100: checking ansi standard C++ stream headers " >&5 echo "configure:1121: checking ansi standard C++ stream headers " >&5
ac_ext=C ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@ -1106,7 +1127,7 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
cross_compiling=$ac_cv_prog_cxx_cross cross_compiling=$ac_cv_prog_cxx_cross
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1110 "configure" #line 1131 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <iostream> #include <iostream>
@ -1115,7 +1136,7 @@ int main() {
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1119: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:1140: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
@ -1147,7 +1168,7 @@ fi
CXXFLAGS_ORIG="$CXXFLAGS" CXXFLAGS_ORIG="$CXXFLAGS"
CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS" CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
echo $ac_n "checking for ansi standard C++ stringstream""... $ac_c" 1>&6 echo $ac_n "checking for ansi standard C++ stringstream""... $ac_c" 1>&6
echo "configure:1151: checking for ansi standard C++ stringstream" >&5 echo "configure:1172: checking for ansi standard C++ stringstream" >&5
ac_ext=C ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@ -1157,7 +1178,7 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
cross_compiling=$ac_cv_prog_cxx_cross cross_compiling=$ac_cv_prog_cxx_cross
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1161 "configure" #line 1182 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <sstream> #include <sstream>
@ -1166,7 +1187,7 @@ int main() {
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1170: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:1191: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
@ -1198,7 +1219,7 @@ if test $ac_cv_prog_gxx = no; then
CXXFLAGS_ORIG="$CXXFLAGS" CXXFLAGS_ORIG="$CXXFLAGS"
CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS" CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
echo $ac_n "checking whether the std namespace is supported""... $ac_c" 1>&6 echo $ac_n "checking whether the std namespace is supported""... $ac_c" 1>&6
echo "configure:1202: checking whether the std namespace is supported" >&5 echo "configure:1223: checking whether the std namespace is supported" >&5
ac_ext=C ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@ -1208,7 +1229,7 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
cross_compiling=$ac_cv_prog_cxx_cross cross_compiling=$ac_cv_prog_cxx_cross
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1212 "configure" #line 1233 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <list> #include <list>
@ -1218,7 +1239,7 @@ int main() {
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1222: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:1243: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
@ -1251,7 +1272,7 @@ if test $ac_cv_prog_gxx = no; then
CXXFLAGS_ORIG="$CXXFLAGS" CXXFLAGS_ORIG="$CXXFLAGS"
CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS" CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
echo $ac_n "checking ansi for scope support""... $ac_c" 1>&6 echo $ac_n "checking ansi for scope support""... $ac_c" 1>&6
echo "configure:1255: checking ansi for scope support" >&5 echo "configure:1276: checking ansi for scope support" >&5
ac_ext=C ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@ -1261,7 +1282,7 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
cross_compiling=$ac_cv_prog_cxx_cross cross_compiling=$ac_cv_prog_cxx_cross
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1265 "configure" #line 1286 "configure"
#include "confdefs.h" #include "confdefs.h"
void foo() { for(int i;;); for(int i;;); } void foo() { for(int i;;); for(int i;;); }
@ -1270,7 +1291,7 @@ int main() {
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1274: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:1295: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
@ -1435,6 +1456,9 @@ s%@RUNMAKE@%$RUNMAKE%g
s%@CC@%$CC%g s%@CC@%$CC%g
s%@CXX@%$CXX%g s%@CXX@%$CXX%g
s%@CMAKE_ROOT_DIR@%$CMAKE_ROOT_DIR%g s%@CMAKE_ROOT_DIR@%$CMAKE_ROOT_DIR%g
s%@CMake_VERSION_MAJOR@%$CMake_VERSION_MAJOR%g
s%@CMake_VERSION_MINOR@%$CMake_VERSION_MINOR%g
s%@CMake_VERSION_PATCH@%$CMake_VERSION_PATCH%g
s%@CMAKE_CONFIG_DIR@%$CMAKE_CONFIG_DIR%g s%@CMAKE_CONFIG_DIR@%$CMAKE_CONFIG_DIR%g
s%@CMAKE_ANSI_CFLAGS@%$CMAKE_ANSI_CFLAGS%g s%@CMAKE_ANSI_CFLAGS@%$CMAKE_ANSI_CFLAGS%g
s%@CMAKE_ANSI_CXXFLAGS@%$CMAKE_ANSI_CXXFLAGS%g s%@CMAKE_ANSI_CXXFLAGS@%$CMAKE_ANSI_CXXFLAGS%g

View File

@ -30,6 +30,18 @@ CXXFLAGS=$save_CXXFLAGS
AC_SUBST(CMAKE_ROOT_DIR) AC_SUBST(CMAKE_ROOT_DIR)
# Parse the cmake version number out of the top-level CMake listfile.
[
CMake_VERSION_MAJOR=`cat $fullSrcDir/CMakeLists.txt | sed -n '/SET *( *CMake_VERSION_MAJOR/ {s/.*MAJOR *\([0-9][0-9]*\).*/\1/;p;}'`
CMake_VERSION_MINOR=`cat $fullSrcDir/CMakeLists.txt | sed -n '/SET *( *CMake_VERSION_MINOR/ {s/.*MINOR *\([0-9][0-9]*\).*/\1/;p;}'`
CMake_VERSION_PATCH=`cat $fullSrcDir/CMakeLists.txt | sed -n '/SET *( *CMake_VERSION_PATCH/ {s/.*PATCH *\([0-9][0-9]*\).*/\1/;p;}'`
]
AC_DEFINE_UNQUOTED(CMake_VERSION_MAJOR, ${CMake_VERSION_MAJOR})
AC_DEFINE_UNQUOTED(CMake_VERSION_MINOR, ${CMake_VERSION_MINOR})
AC_DEFINE_UNQUOTED(CMake_VERSION_PATCH, ${CMake_VERSION_PATCH})
AC_SUBST(CMake_VERSION_MAJOR)
AC_SUBST(CMake_VERSION_MINOR)
AC_SUBST(CMake_VERSION_PATCH)
# Step 1: set the variable "system" to hold the name and version number # Step 1: set the variable "system" to hold the name and version number
# for the system. This can usually be done via the "uname" command, but # for the system. This can usually be done via the "uname" command, but