标签:one 项目 data- exe apach -- direct rar editable
CMake/Testing With CTest
cmake结合CTest的例子
sudo apt install mysql-server mysql-client
sudo apt-get install apache2
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
sudo apt-get install php-cli php-curl php-gd php7.0-xsl
CTest是CMake的一部分,是一个测试框架,可以将构建,配置,测试,覆盖率等指标更新到CDash看板工具上。
有两种模式:
因为要用到cmake server
cmake_minimum_required(VERSION 2.8.3)
project(apue)
# using cmaktools in vscode
include(CMakeToolsHelpers OPTIONAL)
# set output path
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
# set cpp standard
#SET(CMAKE_CXX_FLAGS "-std=c++11")
# set before finding packages
list(APPEND CMAKE_MODULE_PATH ./cmake)
# find packages
# include dirs
include_directories(
/usr/include
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/lib
)
# add subdirectories
add_subdirectory("./include")
add_subdirectory("./lib")
add_subdirectory("src/hello_world")
# add executable
# CTest
if(NOT without-test)
enable_testing()
include(CTest)
add_subdirectory("./gtest-1.8.0")
endif()
# add executable
add_executable(hello_world hello_world.cpp)
target_link_libraries(hello_world apue)
# CTest
enable_testing()
add_executable(hello_world_test hello_world_test.cpp)
target_link_libraries(hello_world_test
gtest
gtest_main
pthread
apue
)
add_test(
NAME apue
COMMAND $<TARGET_FILE:hello_world_test>
)
标签:one 项目 data- exe apach -- direct rar editable
原文地址:https://www.cnblogs.com/lizhensheng/p/11117295.html