@@ -167,64 +167,65 @@ else()
167
167
target_link_libraries (inmemorybenchmarksnappy FastPFOR ${snappy_LIBRARIES} )
168
168
endif ()
169
169
170
- # Download and unpack googletest at configure time
171
- configure_file (CMakeLists.txt.in googletest-download/CMakeLists.txt)
172
- execute_process (COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR} " .
173
- RESULT_VARIABLE result
174
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /googletest-download )
175
- if (result)
176
- message (FATAL_ERROR "CMake step for googletest failed: ${result} " )
177
- endif ()
178
- execute_process (COMMAND ${CMAKE_COMMAND} --build .
179
- RESULT_VARIABLE result
180
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /googletest-download )
181
- if (result)
182
- message (FATAL_ERROR "Build step for googletest failed: ${result} " )
183
- endif ()
184
-
185
- # Prevent GoogleTest from overriding our compiler/linker options
186
- # when building with Visual Studio
187
- set (gtest_force_shared_crt ON CACHE BOOL "" FORCE)
188
-
189
- # Add googletest directly to our build. This adds
190
- # the following targets: gtest, gtest_main, gmock
191
- # and gmock_main
192
- add_subdirectory (${CMAKE_CURRENT_BINARY_DIR} /googletest-src
193
- ${CMAKE_CURRENT_BINARY_DIR} /googletest-build
194
- EXCLUDE_FROM_ALL )
195
-
196
- # The gtest/gmock targets carry header search path
197
- # dependencies automatically when using CMake 2.8.11 or
198
- # later. Otherwise we have to add them here ourselves.
199
- if (CMAKE_VERSION VERSION_LESS 2.8.11)
200
- include_directories ("${gtest_SOURCE_DIR} /include"
201
- "${gmock_SOURCE_DIR} /include" )
202
- endif ()
203
-
204
- add_executable (codecs src/codecs.cpp)
205
- target_link_libraries (codecs FastPFOR)
206
-
207
- add_executable (example example.cpp)
208
- target_link_libraries (example FastPFOR)
209
-
210
- add_executable (inmemorybenchmark src/inmemorybenchmark.cpp)
211
- target_link_libraries (inmemorybenchmark FastPFOR)
212
-
213
- add_executable (unit src/unit.cpp)
214
- target_link_libraries (unit FastPFOR)
215
- add_custom_target (check unit DEPENDS unit)
216
-
217
-
218
- add_executable (FastPFOR_unittest
170
+ option (WITH_TEST "Build with Google Test" ON )
171
+
172
+ if (WITH_TEST)
173
+ # Download and unpack googletest at configure time
174
+ configure_file (CMakeLists.txt.in googletest-download/CMakeLists.txt)
175
+ execute_process (COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR} " .
176
+ RESULT_VARIABLE result
177
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /googletest-download )
178
+ if (result)
179
+ message (FATAL_ERROR "CMake step for googletest failed: ${result} " )
180
+ endif ()
181
+ execute_process (COMMAND ${CMAKE_COMMAND} --build .
182
+ RESULT_VARIABLE result
183
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /googletest-download )
184
+ if (result)
185
+ message (FATAL_ERROR "Build step for googletest failed: ${result} " )
186
+ endif ()
187
+
188
+ # Prevent GoogleTest from overriding our compiler/linker options
189
+ # when building with Visual Studio
190
+ set (gtest_force_shared_crt ON CACHE BOOL "" FORCE)
191
+
192
+ # Add googletest directly to our build. This adds
193
+ # the following targets: gtest, gtest_main, gmock
194
+ # and gmock_main
195
+ add_subdirectory (${CMAKE_CURRENT_BINARY_DIR} /googletest-src
196
+ ${CMAKE_CURRENT_BINARY_DIR} /googletest-build
197
+ EXCLUDE_FROM_ALL )
198
+
199
+ # The gtest/gmock targets carry header search path
200
+ # dependencies automatically when using CMake 2.8.11 or
201
+ # later. Otherwise we have to add them here ourselves.
202
+ if (CMAKE_VERSION VERSION_LESS 2.8.11)
203
+ include_directories ("${gtest_SOURCE_DIR} /include"
204
+ "${gmock_SOURCE_DIR} /include" )
205
+ endif ()
206
+
207
+ add_executable (codecs src/codecs.cpp)
208
+ target_link_libraries (codecs FastPFOR)
209
+
210
+ add_executable (example example.cpp)
211
+ target_link_libraries (example FastPFOR)
212
+
213
+ add_executable (inmemorybenchmark src/inmemorybenchmark.cpp)
214
+ target_link_libraries (inmemorybenchmark FastPFOR)
215
+
216
+ add_executable (unit src/unit.cpp)
217
+ target_link_libraries (unit FastPFOR)
218
+ add_custom_target (check unit DEPENDS unit)
219
+
220
+ add_executable (FastPFOR_unittest
219
221
unittest/test_composite.cpp
220
222
unittest/test_driver.cpp
221
223
unittest/test_fastpfor.cpp
222
224
unittest/test_variablebyte.cpp)
223
- target_link_libraries (FastPFOR_unittest gtest FastPFOR)
224
- enable_testing ()
225
- add_test ("unit" unit)
226
- add_test ("FastPFOR_unittest" FastPFOR_unittest)
227
-
225
+ target_link_libraries (FastPFOR_unittest gtest FastPFOR)
226
+ enable_testing ()
227
+ add_test ("FastPFOR_unittest" FastPFOR_unittest)
228
+ endif ()
228
229
229
230
include (GNUInstallDirs)
230
231
install (TARGETS FastPFOR
@@ -255,4 +256,4 @@ if(NOT CMAKE_VERSION VERSION_LESS 3.0.0)
255
256
endif ()
256
257
configure_file ("fastpfor.pc.in" "${CMAKE_CURRENT_BINARY_DIR} /fastpfor.pc" @ONLY)
257
258
install (FILES "${CMAKE_CURRENT_BINARY_DIR} /fastpfor.pc"
258
- DESTINATION "${CMAKE_INSTALL_LIBDIR} /pkgconfig" )
259
+ DESTINATION "${CMAKE_INSTALL_LIBDIR} /pkgconfig" )
0 commit comments