Skip to content

Commit

Permalink
[CMake] Not require librt for building in Mac OS X
Browse files Browse the repository at this point in the history
Ref #288.
  • Loading branch information
legend committed Jun 29, 2017
1 parent 0862b1d commit 7147892
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@
project(husky)
cmake_minimum_required(VERSION 3.0.2)

# Check building system
if(WIN32)
set(WINDOWS TRUE)
elseif(UNIX AND NOT APPLE)
if(CMAKE_SYSTEM_NAME MATCHES ".*Linux")
set(LINUX TRUE)
endif()
elseif(APPLE)
if(CMAKE_SYSTEM_NAME MATCHES ".*Darwin.*")
set(DARWIN TRUE)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*MacOS.*")
set(MACOSX TRUE)
endif()
endif()

# CMake Options
set(CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 14)
Expand Down
4 changes: 3 additions & 1 deletion cmake/dep.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,13 @@ else(MONGOCLIENT_FOUND)
message (STATUS "Could NOT find MongoClient")
endif(MONGOCLIENT_FOUND)
if(WITHOUT_MONGODB)
unset(MONGOCLIENT_FOUND)
set(MONGOCLIENT_FOUND false)
message(STATUS "Not using MongoClient due to WITHOUT_MONGODB option")
endif(WITHOUT_MONGODB)

### RT ###

if(MONGOCLIENT_FOUND AND NOT MACOSX) # Mac OS X does not have librt
find_library(RT_LIBRARY NAMES rt)
if(RT_LIBRARY)
set(RT_FOUND true)
Expand All @@ -114,6 +115,7 @@ if (RT_FOUND)
else(RT_FOUND)
message (STATUS "Could NOT find RT")
endif(RT_FOUND)
endif(MONGOCLIENT_FOUND AND NOT MACOSX)

### Thrift ###

Expand Down

0 comments on commit 7147892

Please sign in to comment.