Skip to content

Commit

Permalink
Add code to determine operating system in CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
ahojnnes committed Feb 19, 2018
1 parent 018e4ab commit d8e92f5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cmake/CMakeHelper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ if(POLICY CMP0054)
cmake_policy(SET CMP0054 OLD)
endif()

# Determine project compiler.
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(IS_MSVC TRUE)
endif()
Expand All @@ -15,6 +16,17 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(IS_CLANG TRUE)
endif()

# Determine project operating system.
string(REGEX MATCH "Linux" IS_LINUX ${CMAKE_SYSTEM_NAME})
string(REGEX MATCH "BSD" IS_BSD ${CMAKE_SYSTEM_NAME})
string(REGEX MATCH "SunOS" IS_SOLARIS ${CMAKE_SYSTEM_NAME})
if(WIN32)
SET(IS_WINDOWS TRUE BOOL INTERNAL)
endif()
if(APPLE)
SET(IS_MACOS TRUE BOOL INTERNAL)
endif()

string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
if(CMAKE_BUILD_TYPE_LOWER STREQUAL "debug"
OR CMAKE_BUILD_TYPE_LOWER STREQUAL "relwithdebinfo")
Expand Down

0 comments on commit d8e92f5

Please sign in to comment.