cppjieba/test/unittest/CMakeLists.txt
Yanyi Wu 9cd64a1694 build: enhance test configuration and path management
- Added configuration for test paths in CMake to simplify file references.
- Updated load_test.cpp and various unit tests to use defined path macros for dictionary and test data files.
- Introduced test_paths.h.in to manage directory paths consistently across tests.
2025-05-02 23:33:18 +08:00

42 lines
912 B
CMake

message(STATUS "MSVC value: ${MSVC}")
if (MSVC)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDebugDLL")
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
add_compile_options(/utf-8)
endif()
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.12.1
)
FetchContent_MakeAvailable(googletest)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/test)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
ADD_DEFINITIONS(-DLOGGING_LEVEL=LL_WARNING)
# Add include directories
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}/test
)
ADD_EXECUTABLE(test.run
gtest_main.cpp
keyword_extractor_test.cpp
trie_test.cpp
segments_test.cpp
pos_tagger_test.cpp
jieba_test.cpp
pre_filter_test.cpp
unicode_test.cpp
textrank_test.cpp
)
TARGET_LINK_LIBRARIES(test.run gtest)