On QueryException provide the ability to get the connection back out for reuse
[hiphop-php.git] / CMakeLists.txt
blob21225c1259a5b3b46ec025c5566af4616ca39d04
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")
12 # includes
13 SET(
14   CMAKE_MODULE_PATH
15   "${CMAKE_CURRENT_SOURCE_DIR}/CMake"
16   "${CMAKE_CURRENT_SOURCE_DIR}/build/fbcode_builder/CMake"
17   ${CMAKE_MODULE_PATH}
19 include_directories(${CMAKE_CURRENT_BINARY_DIR})
21 PROJECT(hhvm C CXX ASM)
23 include(HHVMProject)
25 if (MSVC)
26   enable_language(ASM_MASM)
27 endif()
29 MARK_AS_ADVANCED(CLEAR CMAKE_INSTALL_PREFIX)
30 IF(APPLE)
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
42     CMAKE_OSX_SYSROOT)
43   SET(CMAKE_OSX_DEPLOYMENT_TARGET 10.15)
44 ENDIF()
46 # Check architecture OS
47 IF(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
48   MESSAGE(FATAL_ERROR "HHVM requires a 64bit OS")
49 ENDIF()
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)
53 if(NOT SKIP_CCACHE)
54   find_program(CCACHE_FOUND ccache)
55   if(CCACHE_FOUND)
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")
59     else()
60       message(STATUS "Found ccache - ccache already in use as C and/or CXX compiler wrapper")
61    endif()
62   endif(CCACHE_FOUND)
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")
72 include(MSVCDefaults)
73 include(Options)
74 include(HPHPCompiler)
75 include(HPHPFindLibs)
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)
83 # modules / depends
84 FILE(GLOB HHVM_CMAKE_FILES "CMake/*.cmake")
85 INSTALL(
86   FILES ${HHVM_CMAKE_FILES}
87   DESTINATION "${CMAKE_INSTALL_LIBDIR}/hhvm/CMake"
88   COMPONENT dev)