]> granicus.if.org Git - libjpeg-turbo/commitdiff
Fix CMake fallback BUILD var on non-U.S. machines
authorDRC <information@libjpeg-turbo.org>
Sun, 1 May 2016 16:42:15 +0000 (11:42 -0500)
committerDRC <information@libjpeg-turbo.org>
Sun, 1 May 2016 17:02:16 +0000 (12:02 -0500)
If wmic.exe wasn't available, then CMakeLists.txt would call
"cmd /C date /T" and parse the result in order to set the BUILD
variable.  However, the parser assumed that the date was in MM/DD/YYYY
format, which is not generally the case unless the user's locale is U.S.
English with the default region/language settings for that locale.

This commit modifies CMakeLists.txt such that it uses the
string(TIMESTAMP) function available in CMake 2.8.11 and later to set
the BUILD variable, thus eliminating the need to use wmic.exe or any
other platform-specific hack.

This commit also modifies the build instructions to remove any reference
to CMake 2.6 (which hasn't been supported by our build system since
libjpeg-turbo 1.3.x.)

Closes #74

BUILDING.txt
CMakeLists.txt

index c68225b47fbb75129adf9672183def7164cd36f3..8f4893b537da215cea9faa0cdb400a40834e2911 100644 (file)
@@ -484,7 +484,7 @@ CFLAGS and -pie from LDFLAGS.
 Build Requirements
 ==================
 
--- CMake (http://www.cmake.org) v2.8.8 or later
+-- CMake (http://www.cmake.org) v2.8.11 or later
 
 -- Microsoft Visual C++ 2005 or later
 
@@ -688,12 +688,11 @@ Native Interface wrapper into the TurboJPEG shared library and build the Java
 front-end classes to support it.  This allows the TurboJPEG shared library to
 be used directly from Java applications.  See java/README for more details.
 
-If you are using CMake 2.8, you can set the Java_JAVAC_EXECUTABLE,
-Java_JAVA_EXECUTABLE, and Java_JAR_EXECUTABLE CMake variables to specify
-alternate commands or locations for javac, jar, and java (respectively.)  If
-you are using CMake 2.6, set JAVA_COMPILE, JAVA_RUNTIME, and JAVA_ARCHIVE
-instead.  You can also set the JAVACFLAGS CMake variable to specify arguments
-that should be passed to the Java compiler when building the front-end classes.
+You can set the Java_JAVAC_EXECUTABLE, Java_JAVA_EXECUTABLE, and
+Java_JAR_EXECUTABLE CMake variables to specify alternate commands or locations
+for javac, jar, and java (respectively.)  You can also set the JAVACFLAGS CMake
+variable to specify arguments that should be passed to the Java compiler when
+building the front-end classes.
 
 
 ========================
index 425e3cdb537fc8c92a4fdbd6b7981c56ed153290..0e83798481078d6f9841d75413b07b2428d96d4c 100644 (file)
@@ -2,7 +2,7 @@
 # Setup
 #
 
-cmake_minimum_required(VERSION 2.8.8)
+cmake_minimum_required(VERSION 2.8.11)
 # Use LINK_INTERFACE_LIBRARIES instead of INTERFACE_LINK_LIBRARIES
 if(POLICY CMP0022)
   cmake_policy(SET CMP0022 OLD)
@@ -11,20 +11,12 @@ endif()
 project(libjpeg-turbo C)
 set(VERSION 1.4.3)
 
-if(WIN32)
-  execute_process(COMMAND "wmic.exe" "os" "get" "LocalDateTime" OUTPUT_VARIABLE
-    BUILD)
-  string(REGEX REPLACE "[^0-9]" "" BUILD "${BUILD}")
-  if (BUILD STREQUAL "")
-    execute_process(COMMAND "cmd.exe" "/C" "DATE" "/T" OUTPUT_VARIABLE BUILD)
-    string(REGEX REPLACE ".*[ ]([0-9]*)[/.]([0-9]*)[/.]([0-9]*).*" "\\3\\2\\1" BUILD "${BUILD}")
-  else()
-    string(SUBSTRING "${BUILD}" 0 8 BUILD)
-  endif()
-else()
+if(NOT WIN32)
   message(FATAL_ERROR "Platform not supported by this build system.  Use autotools instead.")
 endif()
 
+string(TIMESTAMP BUILD "%Y%m%d")
+
 # This does nothing except when using MinGW.  CMAKE_BUILD_TYPE has no meaning
 # in Visual Studio, and it always defaults to Debug when using NMake.
 if(NOT CMAKE_BUILD_TYPE)