diff --git a/osquery/tables/CMakeLists.txt b/osquery/tables/CMakeLists.txt index 0d8b0537..a0ad0b62 100644 --- a/osquery/tables/CMakeLists.txt +++ b/osquery/tables/CMakeLists.txt @@ -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") diff --git a/osquery/tables/system/osx_version.mm b/osquery/tables/system/osx_version.mm index 34908b45..48959ea6 100644 --- a/osquery/tables/system/osx_version.mm +++ b/osquery/tables/system/osx_version.mm @@ -1,6 +1,6 @@ // Copyright 2004-present Facebook. All Rights Reserved. -#include "osquery/database.h" +#include "osquery/database/results.h" #include @@ -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(v.minorVersion); r["patch"] = boost::lexical_cast(v.patchVersion); - return {r}; + results.push_back(r); + } + return results; } } }