auto_plan/tests/CMakeLists.txt

29 lines
995 B
CMake
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

cmake_minimum_required(VERSION 3.10.0)
project(auto_plan_test)
include(FetchContent)
if (MSVC)
add_compile_options(/utf-8)
endif()
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../include)
#include_directories(D:/workspace/googletest-demo/test_main)
#add_executable(demo max.cpp main.cpp)
# 调用 find_package它会使用你提供的变量
find_package(GTest REQUIRED)
include(CTest)
enable_testing()
file(GLOB TEST_SOURCES "../*.cpp")
add_executable(auto_plan_test test_codegen.cpp ${TEST_SOURCES})
target_link_libraries(auto_plan_test gtest gmock gtest_main)
include(GoogleTest)
gtest_discover_tests(auto_plan_test)