Permalink
Browse files

Fix up cmake for working on FreeBSD and OSX

  • Loading branch information...
1 parent 05cc36f commit 4a8a50484e0cdbcbaf94e23d44a68de8653ad6ce @scottmac scottmac committed Aug 9, 2010
Showing with 88 additions and 27 deletions.
  1. +1 −1 CMake/FindBoost.cmake
  2. +5 −10 CMake/FindLdap.cmake
  3. +23 −0 CMake/FindNcurses.cmake
  4. +43 −16 CMake/HPHPFindLibs.cmake
  5. +16 −0 CMake/HPHPSetup.cmake
View
2 CMake/FindBoost.cmake
@@ -637,7 +637,7 @@ ELSE (_boost_IN_CACHE)
endif(Boost_COMPILER)
- if(${Boost_MINOR_VERSION} GREATER 41 AND NOT WIN32)
+ if(${Boost_MINOR_VERSION} GREATER 41 AND NOT WIN32 AND NOT APPLE)
set (_boost_MULTITHREADED "")
else()
SET (_boost_MULTITHREADED "-mt")
View
15 CMake/FindLdap.cmake
@@ -13,16 +13,11 @@ endif(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
if(UNIX)
FIND_PATH(LDAP_INCLUDE_DIR ldap.h)
- if(APPLE)
- FIND_LIBRARY(LDAP_LIBRARIES NAMES LDAP
- PATHS
- /System/Library/Frameworks
- /Library/Frameworks
- )
- else(APPLE)
- FIND_LIBRARY(LDAP_LIBRARIES NAMES ldap)
- FIND_LIBRARY(LBER_LIBRARIES NAMES lber)
- endif(APPLE)
+ FIND_LIBRARY(LDAP_LIBRARIES NAMES ldap)
+ FIND_LIBRARY(LBER_LIBRARIES NAMES lber)
+
+ message(STATUS ${LDAP_LIBRARIES})
+
else(UNIX)
FIND_PATH(LDAP_INCLUDE_DIR winldap.h)
FIND_LIBRARY(LDAP_LIBRARIES NAMES wldap32)
View
23 CMake/FindNcurses.cmake
@@ -0,0 +1,23 @@
+IF(NCURSES_FOUND)
+ SET(NCURSES_FIND_QUIETLY TRUE)
+ENDIF(NCURSES_FOUND)
+
+FIND_PATH(NCURSES_INCLUDE_PATH
+ NAMES ncurses.h curses.h
+ PATH_SUFFIXES ncurses
+ PATHS /usr/include /usr/local/include /usr/pkg/include
+)
+
+FIND_LIBRARY(NCURSES_LIBRARY
+ NAMES ncurses ncursesw
+ PATHS /lib /usr/lib /usr/local/lib /usr/pkg/lib
+)
+
+IF (NCURSES_INCLUDE_PATH AND NCURSES_LIBRARY)
+ SET(NCURSES_FOUND TRUE)
+ENDIF(NCURSES_INCLUDE_PATH AND NCURSES_LIBRARY)
+
+MARK_AS_ADVANCED(
+ NCURSES_INCLUDE_PATH
+ NCURSES_LIBRARY
+)
View
59 CMake/HPHPFindLibs.cmake
@@ -175,29 +175,37 @@ find_package(Ldap REQUIRED)
include_directories(${LDAP_INCLUDE_DIR})
# ncuses, readline and history
-find_package(Curses REQUIRED)
-include_directories(${CURSES_INCLUDE_PATH})
+#set(CURSES_NEED_NCURSES true)
+find_package(Ncurses REQUIRED)
+include_directories(${NCURSES_INCLUDE_PATH})
find_package(Readline REQUIRED)
include_directories(${READLINE_INCLUDE_DIR})
+if (LINUX OR FREEBSD)
+ FIND_LIBRARY (CRYPT_LIB crypt)
+ FIND_LIBRARY (RT_LIB rt)
+elseif (APPLE)
+ FIND_LIBRARY (CRYPT_LIB crypto)
+ FIND_LIBRARY (ICONV_LIB iconv)
+endif()
-FIND_LIBRARY (CRYPT_LIB crypt)
-FIND_LIBRARY (RESOLV_LIB resolv)
-FIND_LIBRARY (RT_LIB rt)
-
+if (LINUX)
+ FIND_LIBRARY (CAP_LIB cap)
-FIND_LIBRARY (CAP_LIB cap)
+ if (NOT CAP_LIB)
+ message(FATAL_ERROR "You need to install libcap")
+ endif()
+endif()
-if (NOT CAP_LIB)
- message(FATAL_ERROR "You need to install libcap")
+if (LINUX OR APPLE)
+ FIND_LIBRARY (DL_LIB dl)
+ FIND_LIBRARY (RESOLV_LIB resolv)
endif()
-# potentially make it look in a different directory for the google tools
FIND_LIBRARY (BFD_LIB bfd)
FIND_LIBRARY (BINUTIL_LIB iberty)
-FIND_LIBRARY (DL_LIB dl)
if (NOT BFD_LIB)
message(FATAL_ERROR "You need to install binutils")
@@ -207,6 +215,10 @@ if (NOT BINUTIL_LIB)
message(FATAL_ERROR "You need to install binutils")
endif()
+if (FREEBSD)
+ FIND_LIBRARY (EXECINFO_LIB execinfo)
+endif()
+
#find_package(BISON REQUIRED)
#find_package(FLEX REQUIRED)
@@ -225,10 +237,21 @@ macro(hphp_link target)
target_link_libraries(${target} ${LIBEVENT_LIB})
target_link_libraries(${target} ${CURL_LIBRARIES})
+if (LINUX)
target_link_libraries(${target} ${CAP_LIB})
+endif()
+
+if (LINUX OR APPLE)
+ target_link_libraries(${target} ${RESOLV_LIB})
+ target_link_libraries(${target} ${DL_LIB})
+endif()
+
+if (FREEBSD)
+ target_link_libraries(${target} ${EXECINFO_LIB})
+endif()
+
target_link_libraries(${target} ${BFD_LIB})
target_link_libraries(${target} ${BINUTIL_LIB})
- target_link_libraries(${target} ${DL_LIB})
target_link_libraries(${target} pthread)
target_link_libraries(${target} ${TBB_LIBRARIES})
target_link_libraries(${target} ${OPENSSL_LIBRARIES})
@@ -245,9 +268,13 @@ macro(hphp_link target)
target_link_libraries(${target} ${LIBMEMCACHED_LIBRARIES})
- target_link_libraries(${target} ${CRYPT_LIB})
- target_link_libraries(${target} ${RESOLV_LIB})
- target_link_libraries(${target} ${RT_LIB})
+ if (LINUX OR FREEBSD)
+ target_link_libraries(${target} ${CRYPT_LIB})
+ target_link_libraries(${target} ${RT_LIB})
+ elseif (APPLE)
+ target_link_libraries(${target} ${CRYPTO_LIB})
+ target_link_libraries(${target} ${ICONV_LIB})
+ endif()
if (USE_TCMALLOC AND HAVE_TCMALLOC)
target_link_libraries(${target} ${GOOGLE_TCMALLOC_LIB})
@@ -266,6 +293,6 @@ macro(hphp_link target)
target_link_libraries(${target} mbfl)
target_link_libraries(${target} ${READLINE_LIBRARY})
- target_link_libraries(${target} ${CURSES_LIBRARIES})
+ target_link_libraries(${target} ${NCURSES_LIBRARY})
endmacro()
View
16 CMake/HPHPSetup.cmake
@@ -20,11 +20,23 @@ int main() { return 0; }" HAVE_GCC_43)
endif()
+set(FREEBSD FALSE)
+set(LINUX FALSE)
+
+if("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
+ set(FREEBSD TRUE)
+endif()
+
+if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
+ set(LINUX TRUE)
+endif()
+
LIST(APPEND CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH}")
if(APPLE)
if(EXISTS "/opt/local/var/macports/")
LIST (APPEND CMAKE_PREFIX_PATH "/opt/local")
+ LIST (APPEND CMAKE_LIBRARY_PATH "/opt/local/lib/x86_64")
endif()
endif()
@@ -37,6 +49,10 @@ if(${CMAKE_BUILD_TYPE} MATCHES "Release")
add_definitions(-DRELEASE=1)
endif()
+if(APPLE OR FREEBSD)
+ add_definitions(-DSKIP_USER_CHANGE=1)
+endif()
+
# eable the OSS options if we have any
add_definitions(-DHPHP_OSS=1)

0 comments on commit 4a8a504

Please sign in to comment.