]> git.mxchange.org Git - flightgear.git/commitdiff
Add cmake Linux distro detection.
authorThorstenB <brehmt@gmail.com>
Sat, 18 Aug 2012 11:40:57 +0000 (13:40 +0200)
committerThorstenB <brehmt@gmail.com>
Sat, 18 Aug 2012 11:40:57 +0000 (13:40 +0200)
CMakeLists.txt
CMakeModules/DetectDistro.cmake [new file with mode: 0644]

index d1180065ce834525e209bfdc13abf5fbcd6eabfa..54409e9fd9ff7d3c65a4deec2d87ba053dfe195e 100644 (file)
@@ -26,6 +26,9 @@ if(InSourceBuild)
     message(WARNING  "  mkdir ../fgbuild && cd ../fgbuild && cmake ${CMAKE_SOURCE_DIR}")
 endif(InSourceBuild)
 
+# System detection/default settings
+include( DetectDistro )
+
 set(CMAKE_DEBUG_POSTFIX          "d" CACHE STRING "add a postfix, usually d on windows")
 set(CMAKE_RELEASE_POSTFIX        ""  CACHE STRING "add a postfix, usually empty on windows")
 set(CMAKE_RELWITHDEBINFO_POSTFIX ""  CACHE STRING "add a postfix, usually empty on windows")
diff --git a/CMakeModules/DetectDistro.cmake b/CMakeModules/DetectDistro.cmake
new file mode 100644 (file)
index 0000000..99e82a0
--- /dev/null
@@ -0,0 +1,13 @@
+# DetectDistro.cmake -- Detect Linux distribution
+
+message(STATUS "System is: ${CMAKE_SYSTEM_NAME}")
+
+if(CMAKE_SYSTEM_NAME MATCHES "Linux")
+    # Detect Linux distribution (if possible)
+    execute_process(COMMAND "/usr/bin/lsb-release" "-is"
+                    TIMEOUT 4
+                    OUTPUT_VARIABLE LINUX_DISTRO
+                    ERROR_QUIET
+                    OUTPUT_STRIP_TRAILING_WHITESPACE)
+    message(STATUS "Linux distro is: ${LINUX_DISTRO}")
+endif()