12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
14
15
+ # Detects the OS and sets appropriate variables.
16
+ # CMAKE_SYSTEM_NAME only give us a coarse-grained name,
17
+ # but the name like centos is necessary in some scenes
18
+ # to distinguish system for customization.
19
+ #
20
+ # for instance, protobuf libs path is <install_dir>/lib64
21
+ # on CentOS, but <install_dir>/lib on other systems.
22
+
15
23
IF (WIN32 )
16
24
SET (HOST_SYSTEM "win32" )
17
25
ELSE (WIN32 )
@@ -21,6 +29,7 @@ ELSE(WIN32)
21
29
SET (MACOS_VERSION ${VERSION} )
22
30
SET (HOST_SYSTEM "macosx" )
23
31
ELSE (APPLE )
32
+
24
33
IF (EXISTS "/etc/issue" )
25
34
FILE (READ "/etc/issue" LINUX_ISSUE)
26
35
IF (LINUX_ISSUE MATCHES "CentOS" )
@@ -29,8 +38,24 @@ ELSE(WIN32)
29
38
SET (HOST_SYSTEM "debian" )
30
39
ELSEIF (LINUX_ISSUE MATCHES "Ubuntu" )
31
40
SET (HOST_SYSTEM "ubuntu" )
41
+ ELSEIF (LINUX_ISSUE MATCHES "Red Hat" )
42
+ SET (HOST_SYSTEM "redhat" )
43
+ ELSEIF (LINUX_ISSUE MATCHES "Fedora" )
44
+ SET (HOST_SYSTEM "fedora" )
32
45
ENDIF ()
33
46
ENDIF (EXISTS "/etc/issue" )
47
+
48
+ IF (EXISTS "/etc/redhat-release" )
49
+ FILE (READ "/etc/redhat-release" LINUX_ISSUE)
50
+ IF (LINUX_ISSUE MATCHES "CentOS" )
51
+ SET (HOST_SYSTEM "centos" )
52
+ ENDIF ()
53
+ ENDIF (EXISTS "/etc/redhat-release" )
54
+
55
+ IF (NOT HOST_SYSTEM )
56
+ SET (HOST_SYSTEM ${CMAKE_SYSTEM_NAME} )
57
+ ENDIF ()
58
+
34
59
ENDIF (APPLE )
35
60
ENDIF (WIN32 )
36
61
@@ -47,7 +72,7 @@ SET(EXTERNAL_PROJECT_LOG_ARGS
47
72
LOG_DOWNLOAD 0 # Wrap download in script to log output
48
73
LOG_UPDATE 1 # Wrap update in script to log output
49
74
LOG_CONFIGURE 1 # Wrap configure in script to log output
50
- LOG_BUILD 1 # Wrap build in script to log output
75
+ LOG_BUILD 0 # Wrap build in script to log output
51
76
LOG_TEST 1 # Wrap test in script to log output
52
- LOG_INSTALL 1 # Wrap install in script to log output
77
+ LOG_INSTALL 0 # Wrap install in script to log output
53
78
)
0 commit comments