1 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7 FATAL_ERROR)
2 # Make `get_target_property()` on a target that does not exist a fatal error
3 # https://cmake.org/cmake/help/v3.0/policy/CMP0045.html
4 cmake_policy(SET CMP0045 NEW)
5 # ditto for add_dependencies(): https://cmake.org/cmake/help/v3.0/policy/CMP0046.html
6 cmake_policy(SET CMP0046 NEW)
8 # This needs to be done before any languages are enabled or
9 # projects are created.
10 INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/CMake/VisualStudioToolset.cmake")
15 "${CMAKE_CURRENT_SOURCE_DIR}/CMake"
16 "${CMAKE_CURRENT_SOURCE_DIR}/build/fbcode_builder/CMake"
19 include_directories(${CMAKE_CURRENT_BINARY_DIR})
21 PROJECT(hhvm C CXX ASM)
26 enable_language(ASM_MASM)
29 MARK_AS_ADVANCED(CLEAR CMAKE_INSTALL_PREFIX)
31 # CMake really likes finding libraries inside OS X frameworks. This can
32 # create super unexpected results, such as the LDAP framework, where the
33 # ldap.h header there just consists of "#include <ldap.h>" -- obviously
34 # assuming /usr/include appears on the include path before that framework
35 # (which wasn't really supposed to be on the include path at all). This
36 # leads to a hilarious recursive include and general fireworks. Instead,
37 # tell CMake to search frameworks *last*, if it doesn't find something in
38 # /usr (or MacPorts/Homebrew).
39 SET(CMAKE_FIND_FRAMEWORK "LAST")
40 MARK_AS_ADVANCED(CMAKE_OSX_ARCHITECTURES
41 CMAKE_OSX_DEPLOYMENT_TARGET
43 SET(CMAKE_OSX_DEPLOYMENT_TARGET 10.15)
46 # Check architecture OS
47 IF(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
48 MESSAGE(FATAL_ERROR "HHVM requires a 64bit OS")
51 # Enable ccache if present and not already enabled system wide.
52 option(SKIP_CCACHE "Skip detecting/enabling ccache - no effect if ccache enabled system wide" FALSE)
54 find_program(CCACHE_FOUND ccache)
56 if (NOT ("${CMAKE_CXX_COMPILER} ${CMAKE_C_COMPILER}" MATCHES ".*ccache.*"))
57 set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_FOUND})
58 message(STATUS "Found ccache: ${CCACHE_FOUND} - enabling ccache as compiler wrapper")
60 message(STATUS "Found ccache - ccache already in use as C and/or CXX compiler wrapper")
63 endif(NOT SKIP_CCACHE)
65 INCLUDE(HPHPFunctions)
66 INCLUDE(CheckFunctionExists)
68 SET(HPHP_HOME ${CMAKE_CURRENT_SOURCE_DIR})
69 SET(TP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third-party")
70 SET(TP_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/third-party")
77 ADD_SUBDIRECTORY(third-party EXCLUDE_FROM_ALL)
78 ADD_SUBDIRECTORY(hphp)
80 # use GNU install dirs (e.g. lib64 instead of lib)
81 INCLUDE(GNUInstallDirs)
84 FILE(GLOB HHVM_CMAKE_FILES "CMake/*.cmake")
86 FILES ${HHVM_CMAKE_FILES}
87 DESTINATION "${CMAKE_INSTALL_LIBDIR}/hhvm/CMake"