forked from grogers0/CppQuickCheck
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
50 lines (41 loc) · 1.31 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
cmake_minimum_required(VERSION 2.6)
project(CppQuickCheck)
if(WIN32)
set(CMAKE_CXX_FLAGS "/W4 /permissive- /EHsc")
else()
set(CMAKE_CXX_FLAGS "-O3 -g -Wall -std=c++11")
endif()
add_library(cppqc INTERFACE)
target_include_directories(cppqc INTERFACE include/)
option(CPPQC_USE_BOOST "Use Boost, allowing to build some of the examples." OFF)
if(CPPQC_USE_BOOST)
find_package(Boost REQUIRED)
endif()
add_subdirectory(examples)
install(DIRECTORY "include/" DESTINATION "include"
PATTERN ".*" EXCLUDE)
# "catch" based unit tests
enable_testing()
add_executable(
all-catch-tests
test/catch-main.cpp
test/arbitrary-tests.cpp
test/shrink-explosion-protection.cpp
test/compact-check-tests.cpp
test/functional-tests.cpp
)
target_include_directories(all-catch-tests PRIVATE include/)
add_test(all-catch-tests all-catch-tests)
# workaround to force CMake to build test executable before running the test
# (source: http://stackoverflow.com/a/736838/783510)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}
DEPENDS all-catch-tests)
# additional target to perform clang-format run, requires clang-format
file(GLOB_RECURSE ALL_SOURCE_FILES *.cpp *.h)
add_custom_target(
clangformat
COMMAND /usr/bin/clang-format
-style=file
-i
${ALL_SOURCE_FILES}
)