Make the build id generation work on other targets than Windows.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4318 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9c692b9..bbe9a27 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,15 +10,21 @@
# The RC version must always be four comma-separated numbers
set(RCVERSION 1,0,90,0)
-if(MINGW OR CYGWIN)
- execute_process(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE BUILD)
- string(REGEX REPLACE "\n" "" BUILD ${BUILD})
-elseif(WIN32)
+# Try to encode today's date into the build id. We assume that MSVC
+# means we need to use a native Windows method, otherwise we assume
+# some kind of Unix system. The id will be empty if things fail.
+set(BUILD "")
+if(MSVC)
execute_process(COMMAND "${CMAKE_SOURCE_DIR}/cmakescripts/getdate.bat"
OUTPUT_VARIABLE BUILD)
- string(REGEX REPLACE "\n" "" BUILD ${BUILD})
else()
- message(FATAL_ERROR "Platform not supported by this build system. Use autotools instead.")
+ execute_process(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE BUILD)
+endif()
+
+if(NOT BUILD)
+ set(BUILD "")
+else()
+ string(REGEX REPLACE "\n" "" BUILD ${BUILD})
endif()
if(NOT CMAKE_BUILD_TYPE)