Allow building under OSX Yosemite using cmake.
authorDavid Ameiss <netshark@ameissnet.com>
Mon, 10 Nov 2014 20:24:18 +0000 (14:24 -0600)
committerStig Bjørlykke <stig@bjorlykke.org>
Mon, 10 Nov 2014 22:03:26 +0000 (22:03 +0000)
CFPropertyListCreateFromStream() has been deprecated in Yosemite, in favor of CFPropertyListCreateWithStream(). The autotools
build checks for the existence of the new function, but the cmake build does not. So, add a check for it to CMakeLists.txt, and
update cmakeconfig.h.in to provide the "template" for HAVE_CFPROPERTYLISTCREATEWITHSTREAM.

Change-Id: I1a4e3e1ce83092ecf7725527b921eeca80b18d4b
Note: CFPropertyListCreateWithStream() works under Mavericks as well.
Reviewed-on: https://code.wireshark.org/review/5226
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
CMakeLists.txt
ConfigureChecks.cmake
cmakeconfig.h.in

index 175e27841546f004e7963125bf6ff14e96aac3e9..3ca9754f385bf143f808a65db1a8c8eb976592b2 100644 (file)
@@ -751,6 +751,17 @@ endif()
 message(STATUS "C-Flags: ${CMAKE_C_FLAGS}")
 message(STATUS "CXX-Flags: ${CMAKE_CXX_FLAGS}")
 
+if(APPLE)
+       #
+       # We assume that APPLE means OS X so that we have the OS X
+       # frameworks.
+       #
+       set(HAVE_OS_X_FRAMEWORKS 1)
+       FIND_LIBRARY (APPLE_APPLICATION_SERVICES_LIBRARY ApplicationServices)
+       FIND_LIBRARY (APPLE_CORE_FOUNDATION_LIBRARY CoreFoundation)
+       FIND_LIBRARY (APPLE_SYSTEM_CONFIGURATION_LIBRARY SystemConfiguration)
+endif()
+
 include(ConfigureChecks.cmake)
 
 #Big or little endian ?
@@ -864,17 +875,6 @@ gmx_test_large_files(GMX_LARGEFILES)
 
 add_definitions( -DTOP_SRCDIR=\"${CMAKE_SOURCE_DIR}\" )
 
-if(APPLE)
-       #
-       # We assume that APPLE means OS X so that we have the OS X
-       # frameworks.
-       #
-       set(HAVE_OS_X_FRAMEWORKS 1)
-       FIND_LIBRARY (APPLE_APPLICATION_SERVICES_LIBRARY ApplicationServices)
-       FIND_LIBRARY (APPLE_CORE_FOUNDATION_LIBRARY CoreFoundation)
-       FIND_LIBRARY (APPLE_SYSTEM_CONFIGURATION_LIBRARY SystemConfiguration)
-endif()
-
 if(WIN32)
        set(WS_MSVC_NORETURN "__declspec(noreturn)")
 
index 010187237c8591baa0dbd61af7ae50c2c29979df..0919b9851430f75c17312572190379cf2c2ca6b3 100644 (file)
@@ -93,6 +93,12 @@ check_function_exists("setresgid"        HAVE_SETRESGID)
 check_function_exists("setresuid"        HAVE_SETRESUID)
 check_function_exists("strptime"         HAVE_STRPTIME)
 check_function_exists("sysconf"          HAVE_SYSCONF)
+if (APPLE)
+       cmake_push_check_state()
+       set(CMAKE_REQUIRED_LIBRARIES ${APPLE_CORE_FOUNDATION_LIBRARY})
+       check_function_exists("CFPropertyListCreateWithStream" HAVE_CFPROPERTYLISTCREATEWITHSTREAM)
+       cmake_pop_check_state()
+endif()
 
 #Struct members
 include(CheckStructHasMember)
index 326818e086fd6f18874a2c77d9f5bc546deb117b..7f1c91a5c904cc341b55a1b01ad64eb88d35d523 100644 (file)
 /* Define to 1 if you have OS X frameworks */
 #cmakedefine HAVE_OS_X_FRAMEWORKS 1
 
+/* Define to 1 if you have the OS X CFPropertyListCreateWithStream function */
+#cmakedefine HAVE_CFPROPERTYLISTCREATEWITHSTREAM 1
+
 /* Define if pcap_breakloop is known */
 #cmakedefine HAVE_PCAP_BREAKLOOP 1