summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2003-02-14 02:57:05 (GMT)
committerBrad King <brad.king@kitware.com>2003-02-14 02:57:05 (GMT)
commit1fe42129d43d659f33ed72e63c26e7c9f8cf64d9 (patch)
tree14e46cb1e8dbb31338cf4fa0ed6f937a218ccb9c
parent170fe935d2cdcbfd02e4385a3ca5abf3bf4b4192 (diff)
downloadCMake-1fe42129d43d659f33ed72e63c26e7c9f8cf64d9.zip
CMake-1fe42129d43d659f33ed72e63c26e7c9f8cf64d9.tar.gz
CMake-1fe42129d43d659f33ed72e63c26e7c9f8cf64d9.tar.bz2
ENH: Centralized setting of CMake version number to top-level CMake listfile.
-rw-r--r--CMakeLists.txt7
-rw-r--r--Source/CMakeLists.txt2
-rw-r--r--Source/WXDialog/CMakeLists.txt8
-rw-r--r--Source/cmConfigure.cmake.h.in5
-rw-r--r--Source/cmConfigure.h.in3
-rw-r--r--Source/cmMakefile.cxx9
-rw-r--r--Source/cmMakefile.h6
-rw-r--r--Source/cmStandardIncludes.h8
-rwxr-xr-xconfigure62
-rw-r--r--configure.in12
10 files changed, 92 insertions, 30 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4f492ad..9ecd734 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,12 @@
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_GENERATOR MATCHES "Visual Studio 7")
SET(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index b69fde5..0c83d53 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -309,8 +309,6 @@ IF(BUILD_TESTING)
ENDIF (APPLE)
ENDIF(BUILD_TESTING)
-
-
INCLUDE (${CMAKE_BINARY_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
INCLUDE (${CMAKE_SOURCE_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
diff --git a/Source/WXDialog/CMakeLists.txt b/Source/WXDialog/CMakeLists.txt
index 2438e16..ada99de 100644
--- a/Source/WXDialog/CMakeLists.txt
+++ b/Source/WXDialog/CMakeLists.txt
@@ -29,12 +29,12 @@ IF ( CMAKE_WX_CAN_COMPILE )
IF(APPLE)
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_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_SHORT_VERSION_STRING "1.7.0")
- SET(APPLE_GUI_BUNDLE_VERSION "1.7.0")
+ SET(APPLE_GUI_SHORT_VERSION_STRING "${CMake_VERSION_MAJOR}")
+ SET(APPLE_GUI_BUNDLE_VERSION "${CMake_VERSION_MAJOR}")
SET(APPLE_GUI_ICON "CMakeIcon.icns")
SET(APPLE_GUI_COPYRIGHT "Copyright 2002 Kitware Inc.")
CONFIGURE_FILE(${CMake_SOURCE_DIR}/Templates/AppleInfo.plist
diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in
index ffff9e0..8f1ec76 100644
--- a/Source/cmConfigure.cmake.h.in
+++ b/Source/cmConfigure.cmake.h.in
@@ -6,5 +6,6 @@
#define CMAKE_BUILD_DIR "${CMake_BINARY_DIR}"
#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@
diff --git a/Source/cmConfigure.h.in b/Source/cmConfigure.h.in
index bff2d77..ba4db57 100644
--- a/Source/cmConfigure.h.in
+++ b/Source/cmConfigure.h.in
@@ -3,3 +3,6 @@
#undef CMAKE_NO_ANSI_STRING_STREAM
#undef CMAKE_NO_ANSI_FOR_SCOPE
+#undef CMake_VERSION_MAJOR
+#undef CMake_VERSION_MINOR
+#undef CMake_VERSION_PATCH
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 7143f59..b386041 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -57,6 +57,15 @@ cmMakefile::cmMakefile()
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()
{
if(!this->GetCacheManager()->GetCacheValue("CMAKE_CACHE_MAJOR_VERSION"))
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index e472781..2b7d91f 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -46,9 +46,9 @@ public:
/**
* Return major and minor version numbers for cmake.
*/
- static unsigned int GetMajorVersion() { return 1;}
- static unsigned int GetMinorVersion() { return 7;}
- static const char *GetReleaseVersion() { return "development";}
+ static unsigned int GetMajorVersion() { return CMake_VERSION_MAJOR; }
+ static unsigned int GetMinorVersion() { return CMake_VERSION_MINOR; }
+ static const char* GetReleaseVersion();
/**
* Return the major and minor version of the cmake that
diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h
index ceab7fc..937d9c2 100644
--- a/Source/cmStandardIncludes.h
+++ b/Source/cmStandardIncludes.h
@@ -21,12 +21,20 @@
#ifndef 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
// CMAKE_NO_ANSI_STREAM_HEADERS and CMAKE_NO_STD_NAMESPACE
#if defined(CMAKE_HAS_AUTOCONF) || defined(CMAKE_BUILD_WITH_CMAKE)
#include "cmConfigure.h"
#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
#pragma warning ( disable : 4786 )
#pragma warning ( disable : 4503 )
diff --git a/configure b/configure
index 545b117..319226b 100755
--- a/configure
+++ b/configure
@@ -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
# 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.
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
system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
else
@@ -998,9 +1019,9 @@ case $system in
CFLAGS_ORIG="$FLAGS"
CFLAGS="-Aa $CFLAGS"
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
-#line 1004 "configure"
+#line 1025 "configure"
#include "confdefs.h"
void foo() {}
@@ -1009,7 +1030,7 @@ int main() {
; return 0; }
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*
echo "$ac_t""yes" 1>&6
@@ -1042,7 +1063,7 @@ rm -f conftest*
CXXFLAGS_ORIG="$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 "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
# 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
cat > conftest.$ac_ext <<EOF
-#line 1056 "configure"
+#line 1077 "configure"
#include "confdefs.h"
void foo() {}
@@ -1061,7 +1082,7 @@ int main() {
; return 0; }
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*
echo "$ac_t""yes" 1>&6
@@ -1096,7 +1117,7 @@ if test $ac_cv_prog_gxx = no; then
CXXFLAGS_ORIG="$CXXFLAGS"
CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
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
# 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
cat > conftest.$ac_ext <<EOF
-#line 1110 "configure"
+#line 1131 "configure"
#include "confdefs.h"
#include <iostream>
@@ -1115,7 +1136,7 @@ int main() {
; return 0; }
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*
echo "$ac_t""yes" 1>&6
@@ -1147,7 +1168,7 @@ fi
CXXFLAGS_ORIG="$CXXFLAGS"
CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
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
# 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
cat > conftest.$ac_ext <<EOF
-#line 1161 "configure"
+#line 1182 "configure"
#include "confdefs.h"
#include <sstream>
@@ -1166,7 +1187,7 @@ int main() {
; return 0; }
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*
echo "$ac_t""yes" 1>&6
@@ -1198,7 +1219,7 @@ if test $ac_cv_prog_gxx = no; then
CXXFLAGS_ORIG="$CXXFLAGS"
CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
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
# 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
cat > conftest.$ac_ext <<EOF
-#line 1212 "configure"
+#line 1233 "configure"
#include "confdefs.h"
#include <list>
@@ -1218,7 +1239,7 @@ int main() {
; return 0; }
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*
echo "$ac_t""yes" 1>&6
@@ -1251,7 +1272,7 @@ if test $ac_cv_prog_gxx = no; then
CXXFLAGS_ORIG="$CXXFLAGS"
CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
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
# 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
cat > conftest.$ac_ext <<EOF
-#line 1265 "configure"
+#line 1286 "configure"
#include "confdefs.h"
void foo() { for(int i;;); for(int i;;); }
@@ -1270,7 +1291,7 @@ int main() {
; return 0; }
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*
echo "$ac_t""yes" 1>&6
@@ -1435,6 +1456,9 @@ s%@RUNMAKE@%$RUNMAKE%g
s%@CC@%$CC%g
s%@CXX@%$CXX%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_ANSI_CFLAGS@%$CMAKE_ANSI_CFLAGS%g
s%@CMAKE_ANSI_CXXFLAGS@%$CMAKE_ANSI_CXXFLAGS%g
diff --git a/configure.in b/configure.in
index 8a95c98..e5eda4a 100644
--- a/configure.in
+++ b/configure.in
@@ -30,6 +30,18 @@ CXXFLAGS=$save_CXXFLAGS
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
# for the system. This can usually be done via the "uname" command, but