~compiz-team/compiz/0.9.12

3659.2.2 by Sam Spilsbury
Require FindThreads.cmake
1
find_package (Threads REQUIRED)
3554.6.1 by Sam Spilsbury
Clean up the Find Google Test and Xorg GTest logic, put them in their own cmake files
2
3753.6.6 by Sam Spilsbury
Move FindGoogleTest.cmake to GoogleTest.cmake - detect the location
3
# Find the the Google Mock include directory
4
# by searching the system-wide include directory
5
# paths
6
find_path (GMOCK_INCLUDE_DIR
7
           gmock/gmock.h)
8
9
if (GMOCK_INCLUDE_DIR)
10
    set (GMOCK_INCLUDE_BASE "include/")
11
    string (LENGTH ${GMOCK_INCLUDE_BASE} GMOCK_INCLUDE_BASE_LENGTH)
12
    string (LENGTH ${GMOCK_INCLUDE_DIR} GMOCK_INCLUDE_DIR_LENGTH)
13
14
    math (EXPR
15
          GMOCK_INCLUDE_PREFIX_LENGTH
16
          "${GMOCK_INCLUDE_DIR_LENGTH} - ${GMOCK_INCLUDE_BASE_LENGTH}")
17
    string (SUBSTRING
18
            ${GMOCK_INCLUDE_DIR}
19
            0
20
            ${GMOCK_INCLUDE_PREFIX_LENGTH}
21
            GMOCK_INCLUDE_PREFIX)
22
3753.6.8 by Sam Spilsbury
Remove duplication and fix wrong order for set ()
23
    set (GMOCK_SRC_DIR ${GMOCK_INCLUDE_PREFIX}/src/gmock CACHE PATH "Path to Google Mock Sources")
24
    set (GMOCK_INCLUDE_DIR ${GMOCK_INCLUDE_DIR} CACHE PATH "Path to Google Mock Headers")
25
    set (GTEST_INCLUDE_DIR ${GMOCK_SRC_DIR}/gtest/include CACHE PATH "Path to Google Test Headers")
3753.6.6 by Sam Spilsbury
Move FindGoogleTest.cmake to GoogleTest.cmake - detect the location
26
3753.6.8 by Sam Spilsbury
Remove duplication and fix wrong order for set ()
27
    set (GMOCK_LIBRARY "gmock" CACHE STRING "Name of the Google Mock library")
28
    set (GMOCK_MAIN_LIBRARY "gmock_main" CACHE STIRNG "Name of the Google Mock main () library")
3753.6.6 by Sam Spilsbury
Move FindGoogleTest.cmake to GoogleTest.cmake - detect the location
29
    set (GTEST_BOTH_LIBRARIES ${CMAKE_THREAD_LIBS_INIT} gtest gtest_main)
30
31
endif (GMOCK_INCLUDE_DIR)
3759.1.1 by Andrea Azzarone
Use new gmock.
32
33
if (NOT GTEST_BOTH_LIBRARIES)
34
35
    set (GTEST_FOUND FALSE)
36
37
else (NOT GTEST_BOTH_LIBRARIES)
38
3554.6.1 by Sam Spilsbury
Clean up the Find Google Test and Xorg GTest logic, put them in their own cmake files
39
    set (GTEST_FOUND TRUE)
3759.1.1 by Andrea Azzarone
Use new gmock.
40
41
endif (NOT GTEST_BOTH_LIBRARIES)
42
3554.6.1 by Sam Spilsbury
Clean up the Find Google Test and Xorg GTest logic, put them in their own cmake files
43
if (NOT GMOCK_LIBRARY OR NOT GMOCK_MAIN_LIBRARY OR NOT GTEST_FOUND)
44
45
    message ("Google Mock and Google Test not found - cannot build tests!")
3759.1.1 by Andrea Azzarone
Use new gmock.
46
    set (GOOGLE_TEST_AND_MOCK_FOUND FALSE)
3554.6.1 by Sam Spilsbury
Clean up the Find Google Test and Xorg GTest logic, put them in their own cmake files
47
48
else (NOT GMOCK_LIBRARY OR NOT GMOCK_MAIN_LIBRARY OR NOT GTEST_FOUND)
49
3759.1.1 by Andrea Azzarone
Use new gmock.
50
    set (GOOGLE_TEST_AND_MOCK_FOUND TRUE)
3554.6.1 by Sam Spilsbury
Clean up the Find Google Test and Xorg GTest logic, put them in their own cmake files
51
3753.6.6 by Sam Spilsbury
Move FindGoogleTest.cmake to GoogleTest.cmake - detect the location
52
    add_definitions(-DGTEST_USE_OWN_TR1_TUPLE=0)
3753.6.8 by Sam Spilsbury
Remove duplication and fix wrong order for set ()
53
    add_subdirectory (${GMOCK_SRC_DIR} ${CMAKE_BINARY_DIR}/__gmock)
3753.6.6 by Sam Spilsbury
Move FindGoogleTest.cmake to GoogleTest.cmake - detect the location
54
    include_directories (${GMOCK_INCLUDE_DIR}
55
                         ${GTEST_INCLUDE_DIR})
56
57
58
endif (NOT GMOCK_LIBRARY OR NOT GMOCK_MAIN_LIBRARY OR NOT GTEST_FOUND)