Skip to content

Commit 7d49db7

Browse files
committed
fix: modernize CMake configuration for notification server tests
Replaced global CMAKE_CXX_FLAGS with target-specific compile options using target_compile_options() for better encapsulation. Removed redundant include(GoogleTest) since find_package(GTest) is already called. Log: Modernize CMake configuration for notification server tests Influence: 1. Verify notifyserverapplet_tests builds successfully 2. Confirm no CMake configuration warnings fix: 现代化通知服务器测试的 CMake 配置 使用 target_compile_options() 替代全局 CMAKE_CXX_FLAGS, 提供更好的封装性。移除冗余的 include(GoogleTest)。 Log: 现代化通知服务器测试的 CMake 配置 Influence: 1. 验证 notifyserverapplet_tests 构建成功 2. 确认没有 CMake 配置警告
1 parent e120516 commit 7d49db7

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

tests/panels/notification/server/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
find_package(GTest REQUIRED)
66
find_package(Qt${QT_VERSION_MAJOR} ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Test DBus)
77

8-
include(GoogleTest)
8+
find_package(GTest REQUIRED)
99

1010
add_executable(notifyserverapplet_tests
1111
${CMAKE_SOURCE_DIR}/panels/notification/server/notifyserverapplet.h
@@ -28,7 +28,7 @@ add_executable(notifyserverapplet_tests
2828
notifyserverapplet_test.cpp
2929
)
3030

31-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
31+
target_compile_options(notifyserverapplet_tests PRIVATE -fvisibility=hidden -fvisibility-inlines-hidden)
3232

3333
target_link_libraries(notifyserverapplet_tests PRIVATE
3434
GTest::GTest
@@ -49,4 +49,9 @@ target_include_directories(notifyserverapplet_tests PRIVATE
4949
${CMAKE_SOURCE_DIR}/frame/
5050
)
5151

52+
set_target_properties(notifyserverapplet_tests PROPERTIES
53+
BUILD_RPATH
54+
"${CMAKE_BINARY_DIR}/frame;${CMAKE_BINARY_DIR}/panels/notification"
55+
)
56+
5257
gtest_discover_tests(notifyserverapplet_tests)

0 commit comments

Comments
 (0)