فهرست منبع

Add self-sufficient wrapper for <sys/stat.h>

Daniel Pfeifer 8 سال پیش
والد
کامیت
e9fc7ff505

+ 1 - 3
Source/CPack/WiX/cmWIXFilesSourceWriter.cxx

@@ -9,9 +9,7 @@
 #include <cmSystemTools.h>
 #include <cmUuid.h>
 
-#include <sys/types.h>
-// include sys/stat.h after sys/types.h
-#include <sys/stat.h>
+#include "cm_sys_stat.h"
 
 cmWIXFilesSourceWriter::cmWIXFilesSourceWriter(cmCPackLog* logger,
                                                std::string const& filename,

+ 1 - 1
Source/CPack/cmCPackCygwinSourceGenerator.cxx

@@ -15,7 +15,7 @@
 // system tools because it is not implemented robustly enough to move
 // files across directories.
 #ifdef _WIN32
-#include <sys/stat.h>
+#include "cm_sys_stat.h"
 #include <windows.h>
 #endif
 

+ 1 - 1
Source/CPack/cmCPackDebGenerator.cxx

@@ -8,6 +8,7 @@
 #include "cmCPackLog.h"
 #include "cmGeneratedFileStream.h"
 #include "cmSystemTools.h"
+#include "cm_sys_stat.h"
 
 #include <cmsys/Glob.hxx>
 #include <limits.h>
@@ -16,7 +17,6 @@
 #include <set>
 #include <stdio.h>
 #include <string.h>
-#include <sys/stat.h>
 #include <utility>
 
 // NOTE:

+ 1 - 1
Source/CPack/cmCPackOSXX11Generator.cxx

@@ -3,12 +3,12 @@
 #include "cmCPackOSXX11Generator.h"
 
 #include <sstream>
-#include <sys/stat.h>
 
 #include "cmCPackGenerator.h"
 #include "cmCPackLog.h"
 #include "cmGeneratedFileStream.h"
 #include "cmSystemTools.h"
+#include "cm_sys_stat.h"
 
 cmCPackOSXX11Generator::cmCPackOSXX11Generator()
 {

+ 1 - 4
Source/CPack/cmCPackSTGZGenerator.cxx

@@ -8,13 +8,10 @@
 #include <string>
 #include <vector>
 
-#include <sys/types.h>
-// include sys/stat.h after sys/types.h
-#include <sys/stat.h>
-
 #include "cmCPackGenerator.h"
 #include "cmCPackLog.h"
 #include "cmSystemTools.h"
+#include "cm_sys_stat.h"
 
 cmCPackSTGZGenerator::cmCPackSTGZGenerator()
 {

+ 1 - 1
Source/CTest/cmCTestSubmitHandler.cxx

@@ -25,8 +25,8 @@
 
 #if defined(CTEST_USE_XMLRPC)
 #include "cmVersion.h"
+#include "cm_sys_stat.h"
 #include <cm_xmlrpc.h>
-#include <sys/stat.h>
 #endif
 
 #define SUBMIT_TIMEOUT_IN_SECONDS_DEFAULT 120

+ 1 - 1
Source/QtDialog/CMakeSetup.cxx

@@ -184,9 +184,9 @@ int main(int argc, char** argv)
 }
 
 #if defined(Q_OS_MAC)
+#include "cm_sys_stat.h"
 #include <errno.h>
 #include <string.h>
-#include <sys/stat.h>
 #include <unistd.h>
 static bool cmOSXInstall(std::string const& dir, std::string const& tool)
 {

+ 1 - 4
Source/cmFileCommand.cxx

@@ -16,10 +16,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <sys/types.h>
-// include sys/stat.h after sys/types.h
-#include <sys/stat.h>
-
 #include "cmAlgorithms.h"
 #include "cmCommandArgumentsHelper.h"
 #include "cmCryptoHash.h"
@@ -35,6 +31,7 @@
 #include "cmSystemTools.h"
 #include "cmTimestamp.h"
 #include "cm_auto_ptr.hxx"
+#include "cm_sys_stat.h"
 #include "cmake.h"
 
 #if defined(CMAKE_BUILD_WITH_CMAKE)

+ 1 - 1
Source/cmFileTimeComparison.cxx

@@ -10,7 +10,7 @@
 
 // Use a platform-specific API to get file times efficiently.
 #if !defined(_WIN32) || defined(__CYGWIN__)
-#include <sys/stat.h>
+#include "cm_sys_stat.h"
 #define cmFileTimeComparison_Type struct stat
 #else
 #include <cmsys/Encoding.hxx>

+ 1 - 6
Source/cmGeneratorExpressionEvaluationFile.h

@@ -11,12 +11,7 @@
 
 #include "cmGeneratorExpression.h"
 #include "cm_auto_ptr.hxx"
-
-#if defined(_MSC_VER)
-typedef unsigned short mode_t;
-#else
-#include <sys/types.h>
-#endif
+#include "cm_sys_stat.h"
 
 class cmLocalGenerator;
 

+ 1 - 0
Source/cmMakefile.cxx

@@ -38,6 +38,7 @@
 #include "cmVersion.h"
 #include "cmWorkingDirectory.h"
 #include "cm_auto_ptr.hxx"
+#include "cm_sys_stat.h"
 #include "cmake.h"
 
 #ifdef CMAKE_BUILD_WITH_CMAKE

+ 1 - 1
Source/cmQtAutoGeneratorInitializer.cxx

@@ -15,6 +15,7 @@
 #include "cmState.h"
 #include "cmSystemTools.h"
 #include "cmTarget.h"
+#include "cm_sys_stat.h"
 #include "cmake.h"
 
 #if defined(_WIN32) && !defined(__CYGWIN__)
@@ -27,7 +28,6 @@
 #include <map>
 #include <set>
 #include <string>
-#include <sys/stat.h>
 #include <utility>
 #include <vector>
 

+ 1 - 1
Source/cmSystemTools.cxx

@@ -4,6 +4,7 @@
 
 #include "cmAlgorithms.h"
 #include "cmProcessOutput.h"
+#include "cm_sys_stat.h"
 
 #if defined(CMAKE_BUILD_WITH_CMAKE)
 #include "cmArchiveWrite.h"
@@ -42,7 +43,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/stat.h>
 #include <time.h>
 #include <utility>
 

+ 0 - 6
Source/cmSystemTools.h

@@ -12,12 +12,6 @@
 #include <string>
 #include <vector>
 
-#if defined(_MSC_VER)
-typedef unsigned short mode_t;
-#else
-#include <sys/types.h>
-#endif
-
 class cmSystemToolsFileTime;
 
 /** \class cmSystemTools

+ 1 - 4
Source/cmWriteFileCommand.cxx

@@ -4,12 +4,9 @@
 
 #include <cmsys/FStream.hxx>
 
-#include <sys/types.h>
-// include sys/stat.h after sys/types.h
-#include <sys/stat.h>
-
 #include "cmMakefile.h"
 #include "cmSystemTools.h"
+#include "cm_sys_stat.h"
 
 class cmExecutionStatus;
 

+ 14 - 0
Source/cm_sys_stat.h

@@ -0,0 +1,14 @@
+/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
+   file Copyright.txt or https://cmake.org/licensing for details.  */
+#ifndef cm_sys_stat_h
+#define cm_sys_stat_h
+
+#if defined(_MSC_VER)
+typedef unsigned short mode_t;
+#endif
+
+#include <sys/types.h>
+// include sys/stat.h after sys/types.h
+#include <sys/stat.h>
+
+#endif

+ 1 - 4
Source/cmake.cxx

@@ -25,6 +25,7 @@
 #include "cmVersionConfig.h"
 #include "cmWorkingDirectory.h"
 #include "cm_auto_ptr.hxx"
+#include "cm_sys_stat.h"
 
 #if defined(CMAKE_BUILD_WITH_CMAKE)
 #include <cm_jsoncpp_writer.h>
@@ -106,10 +107,6 @@
 #include <sys/time.h>
 #endif
 
-#include <sys/types.h>
-// include sys/stat.h after sys/types.h
-#include <sys/stat.h> // struct stat
-
 #include <algorithm>
 #include <cmsys/FStream.hxx>
 #include <cmsys/Glob.hxx>