Cleanup CMakeLists
authorSangwan Kwon <sangwan.kwon@samsung.com>
Mon, 22 Jul 2019 03:00:23 +0000 (12:00 +0900)
committerSangwan Kwon <sangwan.kwon@samsung.com>
Mon, 22 Jul 2019 03:00:23 +0000 (12:00 +0900)
Signed-off-by: Sangwan Kwon <sangwan.kwon@samsung.com>
17 files changed:
CMake/Macro.cmake
osquery/CMakeLists.txt
osquery/config/CMakeLists.txt
osquery/core/CMakeLists.txt
osquery/database/CMakeLists.txt
osquery/devtools/CMakeLists.txt
osquery/dispatcher/CMakeLists.txt
osquery/distributed/CMakeLists.txt
osquery/events/CMakeLists.txt
osquery/extensions/CMakeLists.txt
osquery/filesystem/CMakeLists.txt
osquery/logger/CMakeLists.txt
osquery/registry/CMakeLists.txt
osquery/remote/enroll/tests/enroll_tests.cpp [deleted file]
osquery/sql/CMakeLists.txt
osquery/tables/CMakeLists.txt
osquery/tizen/CMakeLists.txt

index e7023cd..4cf3eb9 100644 (file)
 #  See the License for the specific language governing permissions and
 #  limitations under the License
 
-MACRO(ADD_OSQUERY_LIBRARY CROSS_PLATFORM TARGET)
+MACRO(ADD_OSQUERY_LIBRARY TARGET)
        ADD_LIBRARY(${TARGET} OBJECT ${ARGN})
-
-       IF(${CROSS_PLATFORM})
-               LIST(APPEND ${TARGET_OSQUERY_LIB}_SRCS $<TARGET_OBJECTS:${TARGET}>)
-               SET(${TARGET_OSQUERY_LIB}_SRCS ${${TARGET_OSQUERY_LIB}_SRCS} PARENT_SCOPE)
-       ELSE()
-               LIST(APPEND ${TARGET_OSQUERY_LIB_ONLY_GBS}_SRCS $<TARGET_OBJECTS:${TARGET}>)
-               SET(${TARGET_OSQUERY_LIB_ONLY_GBS}_SRCS
-                       ${${TARGET_OSQUERY_LIB_ONLY_GBS}_SRCS} PARENT_SCOPE)
-       ENDIF()
+       LIST(APPEND ${TARGET_OSQUERY_LIB}_SRCS $<TARGET_OBJECTS:${TARGET}>)
+       SET(${TARGET_OSQUERY_LIB}_SRCS ${${TARGET_OSQUERY_LIB}_SRCS} PARENT_SCOPE)
 ENDMACRO(ADD_OSQUERY_LIBRARY)
 
-MACRO(ADD_OSQUERY_TEST CROSS_PLATFORM)
-       IF(${CROSS_PLATFORM})
-               LIST(APPEND ${TARGET_OSQUERY_LIB}_TESTS ${ARGN})
-               SET(${TARGET_OSQUERY_LIB}_TESTS ${${TARGET_OSQUERY_LIB}_TESTS} PARENT_SCOPE)
-       ELSE()
-               LIST(APPEND ${TARGET_OSQUERY_LIB_ONLY_GBS}_TESTS ${ARGN})
-               SET(${TARGET_OSQUERY_LIB_ONLY_GBS}_TESTS
-                       ${${TARGET_OSQUERY_LIB_ONLY_GBS}_TESTS} PARENT_SCOPE)
-       ENDIF()
+MACRO(ADD_OSQUERY_TEST)
+       LIST(APPEND ${TARGET_OSQUERY_LIB}_TESTS ${ARGN})
+       SET(${TARGET_OSQUERY_LIB}_TESTS ${${TARGET_OSQUERY_LIB}_TESTS} PARENT_SCOPE)
 ENDMACRO(ADD_OSQUERY_TEST)
 
-MACRO(ADD_OSQUERY_LINK CROSS_PLATFORM)
-       IF(${CROSS_PLATFORM})
-               LIST(APPEND ${TARGET_OSQUERY_LIB}_DEPS ${ARGN})
-               SET(${TARGET_OSQUERY_LIB}_DEPS ${${TARGET_OSQUERY_LIB}_DEPS} PARENT_SCOPE)
-       ELSE()
-               LIST(APPEND ${TARGET_OSQUERY_LIB_ONLY_GBS}_DEPS ${ARGN})
-               SET(${TARGET_OSQUERY_LIB_ONLY_GBS}_DEPS
-                       ${${TARGET_OSQUERY_LIB_ONLY_GBS}_DEPS} PARENT_SCOPE)
-       ENDIF()
+MACRO(ADD_OSQUERY_LINK)
+       LIST(APPEND ${TARGET_OSQUERY_LIB}_DEPS ${ARGN})
+       SET(${TARGET_OSQUERY_LIB}_DEPS ${${TARGET_OSQUERY_LIB}_DEPS} PARENT_SCOPE)
 ENDMACRO(ADD_OSQUERY_LINK)
 
 MACRO(TARGET_OSQUERY_LINK_WHOLE TARGET LIBRARY)
index 66066df..66ca685 100644 (file)
@@ -22,31 +22,27 @@ SET(${TARGET_OSQUERY_LIB}_SRCS "")
 SET(${TARGET_OSQUERY_LIB}_DEPS "")
 SET(${TARGET_OSQUERY_LIB}_TESTS "")
 
-SET(${TARGET_OSQUERY_LIB_ONLY_GBS}_SRCS "")
-SET(${TARGET_OSQUERY_LIB_ONLY_GBS}_DEPS "")
-SET(${TARGET_OSQUERY_LIB_ONLY_GBS}_TESTS "")
-
-ADD_OSQUERY_LINK(TRUE glog
-                                         gflags
-                                         pthread
-                                         libthrift.a
-                                       # rocksdb deps
-                                         librocksdb.a
-                                         snappy
-                                         z
-                                         bz2
-                                         dl
-                                         lz4
-                                         zstd
-                                         boost_regex
-                                         boost_system
-                                         boost_thread
-                                         boost_filesystem
-                                         crypto # openssl
-                                       # shell deps
-                                         readline
-                                       # build-in tables deps
-                                         systemd)
+ADD_OSQUERY_LINK(glog
+                                gflags
+                                pthread
+                                libthrift.a
+                               #rocksdb deps
+                                librocksdb.a
+                                snappy
+                                z
+                                bz2
+                                dl
+                                lz4
+                                zstd
+                                boost_regex
+                                boost_system
+                                boost_thread
+                                boost_filesystem
+                                crypto # openssl
+                               #shell deps
+                                readline
+                               #build-in tables deps
+                                systemd)
 
 SET(OSQUERY_CODEGEN_PATH "${CMAKE_SOURCE_DIR}/tools/codegen")
 SET(OSQUERY_TABLES_PATH "${CMAKE_SOURCE_DIR}")
@@ -119,23 +115,12 @@ ADD_SUBDIRECTORY(tizen)
 # static_lib should include every object file in the archive in the link
 # ref: TARGET_OSQUERY_LINK_WHOLE
 ADD_LIBRARY(osquery_generated_tables OBJECT "${AMALGAMATION_FILE_GEN}")
-IF(DEFINED GBS_BUILD)
-       ADD_LIBRARY(${TARGET_OSQUERY_LIB}
-                                       STATIC main/lib.cpp
-                                                  $<TARGET_OBJECTS:osquery_generated_tables>
-                                                  $<TARGET_OBJECTS:osquery_sqlite>
-                                                  ${${TARGET_OSQUERY_LIB}_SRCS}
-                                                  ${${TARGET_OSQUERY_LIB_ONLY_GBS}_SRCS})
-       TARGET_LINK_LIBRARIES(${TARGET_OSQUERY_LIB} ${${TARGET_OSQUERY_LIB}_DEPS}
-                                                                                               ${${TARGET_OSQUERY_LIB_ONLY_GBS}_DEPS})
-ELSE()
-       ADD_LIBRARY(${TARGET_OSQUERY_LIB}
-                                       STATIC main/lib.cpp
-                                                  $<TARGET_OBJECTS:osquery_generated_tables>
-                                                  $<TARGET_OBJECTS:osquery_sqlite>
-                                                  ${${TARGET_OSQUERY_LIB}_SRCS})
-       TARGET_LINK_LIBRARIES(${TARGET_OSQUERY_LIB} ${${TARGET_OSQUERY_LIB}_DEPS})
-ENDIF()
+ADD_LIBRARY(${TARGET_OSQUERY_LIB}
+                               STATIC main/lib.cpp
+                                          $<TARGET_OBJECTS:osquery_generated_tables>
+                                          $<TARGET_OBJECTS:osquery_sqlite>
+                                          ${${TARGET_OSQUERY_LIB}_SRCS})
+TARGET_LINK_LIBRARIES(${TARGET_OSQUERY_LIB} ${${TARGET_OSQUERY_LIB}_DEPS})
 SET_TARGET_PROPERTIES(${TARGET_OSQUERY_LIB} PROPERTIES OUTPUT_NAME ${TARGET_OSQUERY_LIB})
 
 #INSTALL(TARGETS ${TARGET_OSQUERY_LIB}
@@ -170,15 +155,8 @@ INSTALL(TARGETS ${TARGET_OSQUERY_DAEMON}
                                        WORLD_EXECUTE)
 
 ## osquery-test generation ##########################################################
-
-IF(DEFINED GBS_BUILD)
-       ADD_EXECUTABLE(${TARGET_OSQUERY_TEST} main/tests.cpp
-                                                                                 ${${TARGET_OSQUERY_LIB}_TESTS}
-                                                                                 ${${TARGET_OSQUERY_LIB_ONLY_GBS}_TESTS})
-ELSE()
-       ADD_EXECUTABLE(${TARGET_OSQUERY_TEST} main/tests.cpp
-                                                                                 ${${TARGET_OSQUERY_LIB}_TESTS})
-ENDIF()
+ADD_EXECUTABLE(${TARGET_OSQUERY_TEST} main/tests.cpp
+                                                                         ${${TARGET_OSQUERY_LIB}_TESTS})
 TARGET_OSQUERY_LINK_WHOLE(${TARGET_OSQUERY_TEST} ${TARGET_OSQUERY_LIB})
 TARGET_LINK_LIBRARIES(${TARGET_OSQUERY_TEST} gtest)
 SET_TARGET_PROPERTIES(${TARGET_OSQUERY_TEST}
index fa82889..0cb3d7f 100644 (file)
@@ -1,7 +1,22 @@
-ADD_OSQUERY_LIBRARY(TRUE osquery_config config.cpp)
-ADD_OSQUERY_LIBRARY(TRUE osquery_config_plugins update.cpp
-                                                                                               plugins/filesystem.cpp
-                                                                                               parsers/query_packs.cpp)
+#  Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License
+
+ADD_OSQUERY_LIBRARY(osquery_config config.cpp)
+
+ADD_OSQUERY_LIBRARY(osquery_config_plugins update.cpp
+                                                                                  plugins/filesystem.cpp
+                                                                                  parsers/query_packs.cpp)
 
 FILE(GLOB OSQUERY_CONFIG_TESTS "tests/*.cpp")
-ADD_OSQUERY_TEST(TRUE ${OSQUERY_CONFIG_TESTS})
+ADD_OSQUERY_TEST(${OSQUERY_CONFIG_TESTS})
index 908f771..fe39034 100644 (file)
@@ -1,14 +1,28 @@
-ADD_OSQUERY_LIBRARY(TRUE osquery_core init.cpp
-                                                                         conversions.cpp
-                                                                         system.cpp
-                                                                         text.cpp
-                                                                         tables.cpp
-                                                                         flags.cpp
-                                                                         hash.cpp
-                                                                         watcher.cpp)
+#  Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License
+
+ADD_OSQUERY_LIBRARY(osquery_core init.cpp
+                                                                conversions.cpp
+                                                                system.cpp
+                                                                text.cpp
+                                                                tables.cpp
+                                                                flags.cpp
+                                                                hash.cpp
+                                                                watcher.cpp)
 
 # TODO(Sangwan): Detach from core
-ADD_OSQUERY_LIBRARY(TRUE osquery_test_util test_util.cpp)
+ADD_OSQUERY_LIBRARY(osquery_test_util test_util.cpp)
 
 FILE(GLOB OSQUERY_CORE_TESTS "tests/*.cpp")
-ADD_OSQUERY_TEST(TRUE ${OSQUERY_CORE_TESTS})
+ADD_OSQUERY_TEST(${OSQUERY_CORE_TESTS})
index 508dea4..4d47844 100644 (file)
@@ -1,8 +1,21 @@
-ADD_OSQUERY_LIBRARY(TRUE osquery_database database.cpp)
+#  Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License
 
+ADD_OSQUERY_LIBRARY(osquery_database database.cpp)
 
-ADD_OSQUERY_LIBRARY(TRUE osquery_database_internal db_handle.cpp
-                                                                                                  query.cpp)
+ADD_OSQUERY_LIBRARY(osquery_database_internal db_handle.cpp
+                                                                                         query.cpp)
 
 FILE(GLOB OSQUERY_DATABASE_TESTS "tests/*.cpp")
-ADD_OSQUERY_TEST(TRUE ${OSQUERY_DATABASE_TESTS})
+ADD_OSQUERY_TEST(${OSQUERY_DATABASE_TESTS})
index 3bbb276..0d916dc 100644 (file)
@@ -1,4 +1,18 @@
-ADD_OSQUERY_LIBRARY(TRUE osquery_devtools printer.cpp)
+#  Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License
+
+ADD_OSQUERY_LIBRARY(osquery_devtools printer.cpp)
 
 FILE(GLOB OSQUERY_DEVTOOLS_TESTS "tests/*.cpp")
-ADD_OSQUERY_TEST(TRUE ${OSQUERY_DEVTOOLS_TESTS})
+ADD_OSQUERY_TEST(${OSQUERY_DEVTOOLS_TESTS})
index 62c5f28..82b34a2 100644 (file)
@@ -1,5 +1,19 @@
-ADD_OSQUERY_LIBRARY(TRUE osquery_dispatcher dispatcher.cpp
-                                                                                       scheduler.cpp)
+#  Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License
+
+ADD_OSQUERY_LIBRARY(osquery_dispatcher dispatcher.cpp
+                                                                          scheduler.cpp)
 
 FILE(GLOB OSQUERY_DISPATCHER_TESTS "tests/*.cpp")
-ADD_OSQUERY_TEST(TRUE ${OSQUERY_DISPATCHER_TESTS})
+ADD_OSQUERY_TEST(${OSQUERY_DISPATCHER_TESTS})
index 92985e7..f5a2f97 100644 (file)
@@ -1,4 +1,4 @@
-ADD_OSQUERY_LIBRARY(TRUE osquery_distributed distributed.cpp)
+ADD_OSQUERY_LIBRARY(osquery_distributed distributed.cpp)
 
 FILE(GLOB OSQUERY_DISTRIBUTED_TESTS "tests/*.cpp")
-ADD_OSQUERY_TEST(TRUE ${OSQUERY_DISTRIBUTED_TESTS})
+ADD_OSQUERY_TEST(${OSQUERY_DISTRIBUTED_TESTS})
index 6e83833..e2ee61b 100644 (file)
 #  See the License for the specific language governing permissions and
 #  limitations under the License
 
-ADD_OSQUERY_LINK(TRUE udev ip4tc)
+ADD_OSQUERY_LINK(udev ip4tc)
 
-ADD_OSQUERY_LIBRARY(TRUE osquery_events events.cpp)
-ADD_OSQUERY_LIBRARY(TRUE osquery_events_linux linux/inotify.cpp
-                                                                                         linux/udev.cpp)
+ADD_OSQUERY_LIBRARY(osquery_events events.cpp)
+ADD_OSQUERY_LIBRARY(osquery_events_linux linux/inotify.cpp
+                                                                                linux/udev.cpp)
 
 FILE(GLOB OSQUERY_EVENTS_TESTS "tests/*.cpp")
-ADD_OSQUERY_TEST(TRUE ${OSQUERY_EVENTS_TESTS})
+ADD_OSQUERY_TEST(${OSQUERY_EVENTS_TESTS})
 
 FILE(GLOB OSQUERY_LINUX_EVENTS_TESTS "linux/tests/*.cpp")
-ADD_OSQUERY_TEST(TRUE ${OSQUERY_LINUX_EVENTS_TESTS})
+ADD_OSQUERY_TEST(${OSQUERY_LINUX_EVENTS_TESTS})
index 1853110..fb575ab 100644 (file)
@@ -1,3 +1,17 @@
+#  Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License
+
 FIND_PROGRAM(THRIFT_COMPILER thrift /usr/local/bin
                                                                        /usr/bin
                                                                        NO_DEFAULT_PATH)
@@ -14,11 +28,11 @@ ADD_CUSTOM_COMMAND(
        OUTPUT
                ${OSQUERY_THRIFT_GENERATED_FILES})
 
-ADD_OSQUERY_LIBRARY(TRUE osquery_extensions ${OSQUERY_THRIFT_GENERATED_FILES}
-                                                                                       extensions.cpp
-                                                                                       interface.cpp)
+ADD_OSQUERY_LIBRARY(osquery_extensions ${OSQUERY_THRIFT_GENERATED_FILES}
+                                                                          extensions.cpp
+                                                                          interface.cpp)
 
 FILE(GLOB OSQUERY_EXTENSIONS_TESTS "tests/*.cpp")
 
 # TODO: Resolve failed cases
-#ADD_OSQUERY_TEST(TRUE ${OSQUERY_EXTENSIONS_TESTS})
+#ADD_OSQUERY_TEST(${OSQUERY_EXTENSIONS_TESTS})
index e0c10a2..91e6cd6 100644 (file)
@@ -1,8 +1,22 @@
-ADD_OSQUERY_LIBRARY(TRUE osquery_filesystem filesystem.cpp
-                                                                                       globbing.cpp)
+#  Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License
 
-ADD_OSQUERY_LIBRARY(TRUE osquery_filesystem_linux linux/proc.cpp
-                                                                                                 linux/mem.cpp)
+ADD_OSQUERY_LIBRARY(osquery_filesystem filesystem.cpp
+                                                                          globbing.cpp)
+
+ADD_OSQUERY_LIBRARY(osquery_filesystem_linux linux/proc.cpp
+                                                                                        linux/mem.cpp)
 
 FILE(GLOB OSQUERY_FILESYSTEM_TESTS "tests/*.cpp")
-ADD_OSQUERY_TEST(TRUE ${OSQUERY_FILESYSTEM_TESTS})
+ADD_OSQUERY_TEST(${OSQUERY_FILESYSTEM_TESTS})
index fed209b..a87fd66 100644 (file)
@@ -1,9 +1,23 @@
-ADD_OSQUERY_LIBRARY(TRUE osquery_logger logger.cpp)
-ADD_OSQUERY_LIBRARY(TRUE osquery_logger_plugins plugins/filesystem.cpp
-                                                                                               plugins/syslog.cpp)
+#  Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License
+
+ADD_OSQUERY_LIBRARY(osquery_logger logger.cpp)
+ADD_OSQUERY_LIBRARY(osquery_logger_plugins plugins/filesystem.cpp
+                                                                                  plugins/syslog.cpp)
 
 FILE(GLOB OSQUERY_LOGGER_TESTS "tests/*.cpp")
-ADD_OSQUERY_TEST(TRUE ${OSQUERY_LOGGER_TESTS})
+ADD_OSQUERY_TEST(${OSQUERY_LOGGER_TESTS})
 
 file(GLOB OSQUERY_LOGGER_PLUGIN_TESTS "plugins/tests/*.cpp")
-ADD_OSQUERY_TEST(TRUE ${OSQUERY_LOGGER_PLUGIN_TESTS})
+ADD_OSQUERY_TEST(${OSQUERY_LOGGER_PLUGIN_TESTS})
index 1bfec83..b2dfbda 100644 (file)
@@ -1,4 +1,18 @@
-ADD_OSQUERY_LIBRARY(TRUE osquery_registry registry.cpp)
+#  Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License
+
+ADD_OSQUERY_LIBRARY(osquery_registry registry.cpp)
 
 FILE(GLOB OSQUERY_REGISTRY_TESTS "tests/*.cpp")
-ADD_OSQUERY_TEST(TRUE ${OSQUERY_REGISTRY_TESTS})
+ADD_OSQUERY_TEST(${OSQUERY_REGISTRY_TESTS})
diff --git a/osquery/remote/enroll/tests/enroll_tests.cpp b/osquery/remote/enroll/tests/enroll_tests.cpp
deleted file mode 100644 (file)
index 9e98f3e..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- *  Copyright (c) 2014, Facebook, Inc.
- *  All rights reserved.
- *
- *  This source code is licensed under the BSD-style license found in the
- *  LICENSE file in the root directory of this source tree. An additional grant
- *  of patent rights can be found in the PATENTS file in the same directory.
- *
- */
-
-#include <gtest/gtest.h>
-
-#include <osquery/core.h>
-#include <osquery/database.h>
-#include <osquery/enroll.h>
-
-#include "osquery/core/test_util.h"
-
-namespace osquery {
-
-class EnrollTests : public testing::Test {
- public:
-  void SetUp() {
-    deleteDatabaseValue(kPersistentSettings, "nodeKey");
-    deleteDatabaseValue(kPersistentSettings, "nodeKeyTime");
-  }
-};
-
-class SimpleEnrollPlugin : public EnrollPlugin {
- public:
-  SimpleEnrollPlugin() : times_forced_(0) {}
-
- protected:
-  std::string enroll(bool force) {
-    if (force) {
-      forced_response_ = std::to_string(times_forced_);
-      times_forced_++;
-      return forced_response_;
-    }
-    return "fetched_a_node_key";
-  }
-
- private:
-  std::string forced_response_;
-  size_t times_forced_;
-};
-
-// Register our simple enroll plugin.
-REGISTER(SimpleEnrollPlugin, "enroll", "test_simple");
-
-TEST_F(EnrollTests, test_enroll_key_retrieval) {
-  FLAGS_disable_enrollment = true;
-  // Without enrollment, and with an empty nodeKey storage value, no node key
-  // will be fetched or returned from cached.
-  EXPECT_EQ(getNodeKey("test_simple"), "");
-
-  // Turn the enrollment features back on and expect a key.
-  FLAGS_disable_enrollment = false;
-  EXPECT_EQ(getNodeKey("test_simple"), "fetched_a_node_key");
-}
-
-TEST_F(EnrollTests, test_enroll_key_caching) {
-  // Cause a fetch of the node key.
-  auto node_key = getNodeKey("test_simple");
-
-  // Now fetch the time the node key was last cached from the database.
-  std::string key_time;
-  auto status = getDatabaseValue(kPersistentSettings, "nodeKeyTime", key_time);
-  EXPECT_TRUE(status.ok());
-
-  // A subsequent call to getNodeKey will return the same node key.
-  // But, our simple enroll plugin is not enforcing any secret check and is
-  // always returning the same node key.
-  auto node_key2 = getNodeKey("test_simple");
-  // In most scenarios subsequent calls to EnrollPlugin::enroll and the backing
-  // enrollment service will generate and return different node keys.
-  EXPECT_EQ(node_key2, node_key);
-
-  // To work around our contrived example we make sure the node time was not
-  // updated, meaning no call to EnrollPlugin::enroll occurred.
-  std::string key_time2;
-  getDatabaseValue(kPersistentSettings, "nodeKeyTime", key_time2);
-  EXPECT_EQ(key_time2, key_time);
-}
-}
index e0eb2dc..ae844e5 100644 (file)
@@ -1,7 +1,21 @@
-ADD_OSQUERY_LIBRARY(TRUE osquery_sql sql.cpp)
+#  Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License
 
-ADD_OSQUERY_LIBRARY(TRUE osquery_sql_internal sqlite_util.cpp
-                                                                                         virtual_table.cpp)
+ADD_OSQUERY_LIBRARY(osquery_sql sql.cpp)
+
+ADD_OSQUERY_LIBRARY(osquery_sql_internal sqlite_util.cpp
+                                                                                virtual_table.cpp)
 
 FILE(GLOB OSQUERY_SQL_TESTS "tests/*.cpp")
-ADD_OSQUERY_TEST(TRUE ${OSQUERY_SQL_TESTS})
+ADD_OSQUERY_TEST(${OSQUERY_SQL_TESTS})
index b975c70..8fb82c4 100644 (file)
@@ -1,8 +1,22 @@
+#  Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License
+
 FILE(GLOB OSQUERY_LINUX_TABLES "*/linux/*.cpp")
-ADD_OSQUERY_LIBRARY(TRUE osquery_linux_tables ${OSQUERY_LINUX_TABLES})
+ADD_OSQUERY_LIBRARY(osquery_linux_tables ${OSQUERY_LINUX_TABLES})
 
 FILE(GLOB OSQUERY_CROSS_TABLES "*/*.cpp")
-ADD_OSQUERY_LIBRARY(TRUE osquery_tables ${OSQUERY_CROSS_TABLES})
+ADD_OSQUERY_LIBRARY(osquery_tables ${OSQUERY_CROSS_TABLES})
 
 FILE(GLOB OSQUERY_CROSS_TABLES_TESTS "[!uo]*/tests/*.cpp")
-ADD_OSQUERY_TEST(TRUE ${OSQUERY_CROSS_TABLES_TESTS})
+ADD_OSQUERY_TEST(${OSQUERY_CROSS_TABLES_TESTS})
index b87a065..9593df8 100644 (file)
 #  See the License for the specific language governing permissions and
 #  limitations under the License
 
-ADD_OSQUERY_LIBRARY(TRUE osquery_property property/property.cpp)
-
-ADD_OSQUERY_LIBRARY(TRUE osquery_manager manager/manager.cpp
-                                                                                manager/manager_impl.cpp)
-
-ADD_OSQUERY_LIBRARY(TRUE osquery_notification notification/notification.cpp)
+ADD_OSQUERY_LIBRARY(osquery_tizen property/property.cpp
+                                                                 manager/manager.cpp
+                                                                 manager/manager_impl.cpp
+                                                                 notification/notification.cpp)
 
 FILE(GLOB OSQUERY_TIZEN_TESTS "*/tests/*.cpp")
-ADD_OSQUERY_TEST(TRUE ${OSQUERY_TIZEN_TESTS})
+ADD_OSQUERY_TEST(${OSQUERY_TIZEN_TESTS})
 
 IF(DEFINED GBS_BUILD)
        SET(GBS_ONLY_PACKAGES klay
@@ -33,7 +31,7 @@ IF(DEFINED GBS_BUILD)
        PKG_CHECK_MODULES(GBS_DEPS REQUIRED ${GBS_ONLY_PACKAGES})
        INCLUDE_DIRECTORIES(SYSTEM ${GBS_DEPS_INCLUDE_DIRS})
 
-       ADD_OSQUERY_LINK(FALSE ${GBS_DEPS_LIBRARIES})
-       ADD_OSQUERY_LIBRARY(FALSE tizen-dpm-wifi device-policy/wifi/wifi.cpp
-                                                                                        device-policy/wifi/wifi-impl.cpp)
+       ADD_OSQUERY_LINK(${GBS_DEPS_LIBRARIES})
+       ADD_OSQUERY_LIBRARY(device_policy_wifi device-policy/wifi/wifi.cpp
+                                                                                  device-policy/wifi/wifi-impl.cpp)
 ENDIF(DEFINED GBS_BUILD)