CMakeLists.txt 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # Copyright 2013 Google Inc. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. cmake_minimum_required(VERSION 2.6)
  15. project(cppbtree CXX)
  16. option(build_tests "Build B-tree tests" OFF)
  17. add_definitions(-std=c++11)
  18. set(CMAKE_CXX_FLAGS "-g -O2")
  19. # CMake doesn't have a way to pure template library,
  20. # add_library(cppbtree btree.h btree_map.h btree_set.h
  21. # safe_btree.h safe_btree_map.h safe_btree_set.h)
  22. # set_target_properties(cppbtree PROPERTIES LINKER_LANGUAGE CXX)
  23. if(build_tests)
  24. enable_testing()
  25. include_directories($ENV{GTEST_ROOT}/include)
  26. link_directories($ENV{GTEST_ROOT})
  27. include_directories($ENV{GFLAGS_ROOT}/include)
  28. link_directories($ENV{GFLAGS_ROOT}/lib)
  29. add_executable(btree_test btree_test.cc btree_test_flags.cc)
  30. add_executable(safe_btree_test safe_btree_test.cc btree_test_flags.cc)
  31. add_executable(btree_bench btree_bench.cc btree_test_flags.cc)
  32. target_link_libraries(btree_test gtest_main gtest gflags)
  33. target_link_libraries(safe_btree_test gtest_main gtest gflags)
  34. target_link_libraries(btree_bench gflags gtest)
  35. endif()