Skip to content

Commit

Permalink
Merge d4c364f into bd0429e
Browse files Browse the repository at this point in the history
  • Loading branch information
milipili committed Jun 16, 2018
2 parents bd0429e + d4c364f commit a42c366
Showing 1 changed file with 30 additions and 23 deletions.
53 changes: 30 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,43 @@
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}")

add_executable(argstest test.cxx)
target_link_libraries(argstest args)
set_property(TARGET argstest PROPERTY CXX_STANDARD 11)
if (ARGS_BUILD_EXAMPLE)
add_executable(gitlike examples/gitlike.cxx)
target_link_libraries(gitlike args)
set_property(TARGET gitlike 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 ()
add_executable(completion examples/completion.cxx)
target_link_libraries(completion args)
set_property(TARGET completion PROPERTY CXX_STANDARD 11)
endif()

add_executable(argstest-multiple-inclusion test/multiple_inclusion_1.cxx test/multiple_inclusion_2.cxx)
if (ARGS_BUILD_UNITTESTS)
add_executable(argstest test.cxx)
target_link_libraries(argstest args)
set_property(TARGET argstest PROPERTY CXX_STANDARD 11)

target_link_libraries(argstest-multiple-inclusion args)
set_property(TARGET argstest-multiple-inclusion 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 ()

add_executable(gitlike examples/gitlike.cxx)
target_link_libraries(gitlike args)
set_property(TARGET gitlike PROPERTY CXX_STANDARD 11)
add_executable(argstest-multiple-inclusion test/multiple_inclusion_1.cxx test/multiple_inclusion_2.cxx)

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)
target_link_libraries(argstest-multiple-inclusion args)
set_property(TARGET argstest-multiple-inclusion PROPERTY CXX_STANDARD 11)

add_executable(completion examples/completion.cxx)
target_link_libraries(completion args)
set_property(TARGET completion 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()

0 comments on commit a42c366

Please sign in to comment.