~klap-in/compiz/bug904205

« back to all changes in this revision

Viewing changes to CMakeLists.txt

  • Committer: Daniel van Vugt
  • Author(s): smspillaz
  • Date: 2012-07-02 06:29:03 UTC
  • mfrom: (3270.1.1 compiz)
  • Revision ID: daniel.van.vugt@canonical.com-20120702062903-7wfylbs5prm0tmvz
Fix COMPIZ_BUILD_TESTING being set to OFF

Show diffs side-by-side

added added

removed removed

Lines of Context:
123
123
    DESTINATION ${libdir}/pkgconfig
124
124
)
125
125
 
126
 
# Build Google Test and make its headers known
127
 
find_package (GTest)
128
 
 
129
 
if (NOT GTEST_FOUND)
130
 
 
131
 
    # Check for google test and build it locally
132
 
    set (GTEST_ROOT_DIR
133
 
        "/usr/src/gtest" # Default value, adjustable by user with e.g., ccmake
134
 
        CACHE
135
 
        PATH
136
 
        "Path to Google test srcs"
137
 
    )
138
 
 
139
 
    find_path (GTEST_INCLUDE_DIR gtest/gtest.h)
140
 
 
141
 
    if (GTEST_INCLUDE_DIR)
142
 
        #FIXME - hardcoded is bad!
143
 
        add_subdirectory (${GTEST_ROOT_DIR}
144
 
                      gtest)
145
 
    endif(GTEST_INCLUDE_DIR)
146
 
 
147
 
    set (GTEST_BOTH_LIBRARIES gtest gtest_main)
148
 
    set (GTEST_FOUND TRUE)
149
 
 
150
 
endif (NOT GTEST_FOUND)
151
 
 
152
 
find_library (GMOCK_LIBRARY gmock)
153
 
find_library (GMOCK_MAIN_LIBRARY gmock_main)
154
 
 
155
 
if (NOT GMOCK_LIBRARY OR NOT GMOCK_MAIN_LIBRARY OR NOT GTEST_FOUND)
156
 
  message ("Google Mock and Google Test not found - cannot build tests!")
157
 
  set (COMPIZ_BUILD_TESTING OFF)
158
 
endif (NOT GMOCK_LIBRARY OR NOT GMOCK_MAIN_LIBRARY OR NOT GTEST_FOUND)
159
 
 
160
 
include_directories (${GTEST_INCLUDE_DIRS})
 
126
if (COMPIZ_BUILD_TESTING)
 
127
 
 
128
    # Build Google Test and make its headers known
 
129
    find_package (GTest)
 
130
 
 
131
    if (NOT GTEST_FOUND)
 
132
 
 
133
        # Check for google test and build it locally
 
134
        set (GTEST_ROOT_DIR
 
135
             "/usr/src/gtest" # Default value, adjustable by user with e.g., ccmake
 
136
             CACHE
 
137
             PATH
 
138
             "Path to Google Test srcs"
 
139
             FORCE
 
140
        )
 
141
 
 
142
        find_path (GTEST_INCLUDE_DIR gtest/gtest.h)
 
143
 
 
144
        if (GTEST_INCLUDE_DIR)
 
145
            add_subdirectory (${GTEST_ROOT_DIR}
 
146
                             gtest)
 
147
        endif (GTEST_INCLUDE_DIR)
 
148
 
 
149
        set (GTEST_BOTH_LIBRARIES gtest gtest_main)
 
150
        set (GTEST_FOUND TRUE)
 
151
 
 
152
    endif (NOT GTEST_FOUND)
 
153
 
 
154
    find_library (GMOCK_LIBRARY gmock)
 
155
    find_library (GMOCK_MAIN_LIBRARY gmock_main)
 
156
 
 
157
    if (NOT GMOCK_LIBRARY OR NOT GMOCK_MAIN_LIBRARY OR NOT GTEST_FOUND)
 
158
 
 
159
        message ("Google Mock and Google Test not found - cannot build tests!")
 
160
        set (COMPIZ_BUILD_TESTING OFF CACHE BOOL "" FORCE)
 
161
 
 
162
    else (NOT GMOCK_LIBRARY OR NOT GMOCK_MAIN_LIBRARY OR NOT GTEST_FOUND)
 
163
 
 
164
        include_directories (${GTEST_INCLUDE_DIRS})
 
165
 
 
166
    endif (NOT GMOCK_LIBRARY OR NOT GMOCK_MAIN_LIBRARY OR NOT GTEST_FOUND)
 
167
 
 
168
endif (COMPIZ_BUILD_TESTING)
161
169
 
162
170
find_package (Threads REQUIRED)
163
171