add ENABLE_TEST OPTION

This commit is contained in:
huangsimin 2020-04-01 10:35:56 +08:00
parent 8863c2ff2a
commit a8abebd466
2 changed files with 9 additions and 2 deletions

2
.vscode/tasks.json vendored
View File

@ -9,7 +9,7 @@
"command": "bash",
"args": [
"-c",
"cd ${workspaceFolder}/build && cmake .. -DCMAKE_BUILD_TYPE=Debug && make -j4",
"cd ${workspaceFolder} && mkdir -p build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Debug && make -j4",
],
"options": {
"cwd": "/bin"

View File

@ -5,6 +5,8 @@ SET(CMAKE_BUILD_TYPE "Debug")
SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb")
SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")
option(ENABLE_TEST "gtest build" OFF)
# include(CTest)
# enable_testing()
@ -19,7 +21,12 @@ link_directories(
/usr/local/lib/
)
add_subdirectory(gtest)
if(ENABLE_TEST)
add_subdirectory(gtest)
endif(ENABLE_TEST)
add_executable(orderly src/main.cpp)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})