breaking out objective-c tables such that they use arc

This commit is contained in:
mike@arpaia.co 2014-08-30 03:17:52 -07:00
parent 92845146d7
commit 3b05ffb97d
2 changed files with 18 additions and 4 deletions

View File

@ -3,6 +3,15 @@ FILE(GLOB table_sources
"manual/*.cpp"
)
if(APPLE)
ADD_LIBRARY(osquery_tables_objc
../core/osx/NSProcessInfo+PECocoaBackports.mm
system/osx_version.mm
)
TARGET_LINK_LIBRARIES(osquery_tables_objc "-framework Foundation")
SET_TARGET_PROPERTIES(osquery_tables_objc PROPERTIES COMPILE_FLAGS "-x objective-c++ -fobjc-arc")
endif()
ADD_LIBRARY(osquery_tables
registry.cpp
${table_sources}
@ -14,8 +23,6 @@ ADD_LIBRARY(osquery_tables
system/kextstat.cpp
system/processes.cpp
system/nvram.cpp
../core/osx/NSProcessInfo+PECocoaBackports.mm
system/osx_version.mm
system/firewall.cpp
system/apps.cpp
system/launchd.cpp
@ -28,6 +35,9 @@ TARGET_LINK_LIBRARIES(osquery_tables glog)
TARGET_LINK_LIBRARIES(osquery_tables osquery_filesystem)
TARGET_LINK_LIBRARIES(osquery_tables osquery_sqlite)
TARGET_LINK_LIBRARIES(osquery_tables "-Wl,-all_load")
if(APPLE)
TARGET_LINK_LIBRARIES(osquery_tables osquery_tables_objc)
endif()
SET_TARGET_PROPERTIES(osquery_tables PROPERTIES COMPILE_FLAGS "-std=c++11 -stdlib=libc++")
TARGET_LINK_LIBRARIES(osquery_tables "-framework IOKit -framework CoreFoundation -framework Security")

View File

@ -1,6 +1,6 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#include "osquery/database.h"
#include "osquery/database/results.h"
#include <string>
@ -14,6 +14,8 @@ namespace osquery {
namespace tables {
QueryData genOSXVersion() {
QueryData results;
@autoreleasepool {
NSOperatingSystemVersion v =
[[NSProcessInfo processInfo] operatingSystemVersion];
@ -23,7 +25,9 @@ QueryData genOSXVersion() {
r["minor"] = boost::lexical_cast<std::string>(v.minorVersion);
r["patch"] = boost::lexical_cast<std::string>(v.patchVersion);
return {r};
results.push_back(r);
}
return results;
}
}
}