-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
49 lines (39 loc) · 1.64 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
cmake_minimum_required(VERSION 2.8.2)
project(example)
include(CTest)
if (CMAKE_VERSION VERSION_LESS 3.2)
set(UPDATE_DISCONNECTED_IF_AVAILABLE "")
else()
set(UPDATE_DISCONNECTED_IF_AVAILABLE "UPDATE_DISCONNECTED 1")
endif()
include(external/DownloadProject/DownloadProject.cmake)
download_project(PROJ googletest
PREFIX CMAKE_SOURCE_DIR/external/googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG master
${UPDATE_DISCONNECTED_IF_AVAILABLE}
)
# Prevent GoogleTest from overriding our compiler/linker options
# when building with Visual Studio
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
# When using CMake 2.8.11 or later, header path dependencies
# are automatically added to the gtest and gmock targets.
# For earlier CMake versions, we have to explicitly add the
# required directories to the header search path ourselves.
if (CMAKE_VERSION VERSION_LESS 2.8.11)
include_directories("${gtest_SOURCE_DIR}/include"
"${gmock_SOURCE_DIR}/include")
endif()
#add your project
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
find_package(QRLIB QUIET)
if (NOT QR_LIB_FOUND)
message(FATAL_ERROR "Project not found")
endif()
include_directories(${QR_SOURCE_DIR}/qrgen)
add_subdirectory(${QR_SOURCE_DIR}/qrgen qrgen.out)
# Trivial example using gtest and gmock
add_executable(${PROJECT_NAME}Tests exampleTests.cpp)
target_link_libraries(${PROJECT_NAME}Tests gtest gmock_main qrgen)
add_test(NAME ${PROJECT_NAME}Tests COMMAND ${PROJECT_NAME}Tests)