Add cmake Linux distro detection.
This commit is contained in:
parent
c15af10a7d
commit
9c87aeb1fc
2 changed files with 16 additions and 0 deletions
|
@ -26,6 +26,9 @@ if(InSourceBuild)
|
||||||
message(WARNING " mkdir ../fgbuild && cd ../fgbuild && cmake ${CMAKE_SOURCE_DIR}")
|
message(WARNING " mkdir ../fgbuild && cd ../fgbuild && cmake ${CMAKE_SOURCE_DIR}")
|
||||||
endif(InSourceBuild)
|
endif(InSourceBuild)
|
||||||
|
|
||||||
|
# System detection/default settings
|
||||||
|
include( DetectDistro )
|
||||||
|
|
||||||
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows")
|
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_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
|
||||||
set(CMAKE_RELWITHDEBINFO_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
|
set(CMAKE_RELWITHDEBINFO_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
|
||||||
|
|
13
CMakeModules/DetectDistro.cmake
Normal file
13
CMakeModules/DetectDistro.cmake
Normal file
|
@ -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()
|
Loading…
Add table
Reference in a new issue