aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt37
1 files changed, 20 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d874d1f..c59cfa9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,6 +23,7 @@ cmake_minimum_required(VERSION 3.2)
project(args CXX)
option(ARGS_BUILD_EXAMPLE "Build example" ON)
+option(ARGS_BUILD_UNITTESTS "Build unittests" ON)
add_library(args INTERFACE)
target_include_directories(args INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
@@ -37,25 +38,27 @@ if (ARGS_BUILD_EXAMPLE)
set_property(TARGET completion PROPERTY CXX_STANDARD 11)
endif()
-add_executable(argstest test.cxx)
-target_link_libraries(argstest args)
-set_property(TARGET argstest PROPERTY CXX_STANDARD 11)
+if (ARGS_BUILD_UNITTESTS)
+ add_executable(argstest test.cxx)
+ target_link_libraries(argstest args)
+ set_property(TARGET argstest PROPERTY CXX_STANDARD 11)
-if (MSVC)
- target_compile_options(argstest PRIVATE /W4 /WX /bigobj)
-else ()
- target_compile_options(argstest PRIVATE -Wall -Wextra -Werror -pedantic -Wshadow -Wunused-parameter)
-endif ()
+ if (MSVC)
+ target_compile_options(argstest PRIVATE /W4 /WX /bigobj)
+ else ()
+ target_compile_options(argstest PRIVATE -Wall -Wextra -Werror -pedantic -Wshadow -Wunused-parameter)
+ endif ()
-add_executable(argstest-multiple-inclusion test/multiple_inclusion_1.cxx test/multiple_inclusion_2.cxx)
+ add_executable(argstest-multiple-inclusion test/multiple_inclusion_1.cxx test/multiple_inclusion_2.cxx)
-target_link_libraries(argstest-multiple-inclusion args)
-set_property(TARGET argstest-multiple-inclusion PROPERTY CXX_STANDARD 11)
+ target_link_libraries(argstest-multiple-inclusion args)
+ set_property(TARGET argstest-multiple-inclusion PROPERTY CXX_STANDARD 11)
-add_executable(argstest-windows-h test/windows_h.cxx)
-target_link_libraries(argstest-windows-h args)
-set_property(TARGET argstest-windows-h PROPERTY CXX_STANDARD 11)
+ add_executable(argstest-windows-h test/windows_h.cxx)
+ target_link_libraries(argstest-windows-h args)
+ set_property(TARGET argstest-windows-h PROPERTY CXX_STANDARD 11)
-enable_testing()
-add_test(NAME "test" COMMAND argstest)
-add_test(NAME "test-multiple-inclusion" COMMAND argstest-multiple-inclusion)
+ enable_testing()
+ add_test(NAME "test" COMMAND argstest)
+ add_test(NAME "test-multiple-inclusion" COMMAND argstest-multiple-inclusion)
+endif()