123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287 |
- option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF)
- option(
- gtest_force_shared_crt
- "Use shared (DLL) run-time lib even when Google Test is built as static lib."
- OFF)
- option(gtest_build_tests "Build all of gtest's own tests." OFF)
- option(gtest_build_samples "Build gtest's sample programs." OFF)
- option(gtest_disable_pthreads "Disable uses of pthreads in gtest." OFF)
- option(
- gtest_hide_internal_symbols
- "Build gtest with internal symbols hidden in shared libraries."
- OFF)
- include(cmake/hermetic_build.cmake OPTIONAL)
- if (COMMAND pre_project_set_up_hermetic_build)
- pre_project_set_up_hermetic_build()
- endif()
- set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
- project(gtest CXX C)
- cmake_minimum_required(VERSION 2.6.2)
- if (COMMAND set_up_hermetic_build)
- set_up_hermetic_build()
- endif()
- if (gtest_hide_internal_symbols)
- set(CMAKE_CXX_VISIBILITY_PRESET hidden)
- set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
- endif()
- include(cmake/internal_utils.cmake)
- config_compiler_and_linker()
- include_directories(
- ${gtest_SOURCE_DIR}/include
- ${gtest_SOURCE_DIR})
- link_directories(${gtest_BINARY_DIR}/src)
- if (MSVC AND MSVC_VERSION EQUAL 1700)
- add_definitions(/D _VARIADIC_MAX=10)
- endif()
- cxx_library(gtest "${cxx_strict}" src/gtest-all.cc)
- cxx_library(gtest_main "${cxx_strict}" src/gtest_main.cc)
- target_link_libraries(gtest_main gtest)
- if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11")
- target_include_directories(gtest INTERFACE "${gtest_SOURCE_DIR}/include")
- target_include_directories(gtest_main INTERFACE "${gtest_SOURCE_DIR}/include")
- endif()
- install(TARGETS gtest gtest_main
- DESTINATION lib)
- if (gtest_build_samples)
- cxx_executable(sample1_unittest samples gtest_main samples/sample1.cc)
- cxx_executable(sample2_unittest samples gtest_main samples/sample2.cc)
- cxx_executable(sample3_unittest samples gtest_main)
- cxx_executable(sample4_unittest samples gtest_main samples/sample4.cc)
- cxx_executable(sample5_unittest samples gtest_main samples/sample1.cc)
- cxx_executable(sample6_unittest samples gtest_main)
- cxx_executable(sample7_unittest samples gtest_main)
- cxx_executable(sample8_unittest samples gtest_main)
- cxx_executable(sample9_unittest samples gtest)
- cxx_executable(sample10_unittest samples gtest)
- endif()
- if (gtest_build_tests)
-
-
- enable_testing()
-
-
- cxx_test(gtest-death-test_test gtest_main)
- cxx_test(gtest_environment_test gtest)
- cxx_test(gtest-filepath_test gtest_main)
- cxx_test(gtest-linked_ptr_test gtest_main)
- cxx_test(gtest-listener_test gtest_main)
- cxx_test(gtest_main_unittest gtest_main)
- cxx_test(gtest-message_test gtest_main)
- cxx_test(gtest_no_test_unittest gtest)
- cxx_test(gtest-options_test gtest_main)
- cxx_test(gtest-param-test_test gtest
- test/gtest-param-test2_test.cc)
- cxx_test(gtest-port_test gtest_main)
- cxx_test(gtest_pred_impl_unittest gtest_main)
- cxx_test(gtest_premature_exit_test gtest
- test/gtest_premature_exit_test.cc)
- cxx_test(gtest-printers_test gtest_main)
- cxx_test(gtest_prod_test gtest_main
- test/production.cc)
- cxx_test(gtest_repeat_test gtest)
- cxx_test(gtest_sole_header_test gtest_main)
- cxx_test(gtest_stress_test gtest)
- cxx_test(gtest-test-part_test gtest_main)
- cxx_test(gtest_throw_on_failure_ex_test gtest)
- cxx_test(gtest-typed-test_test gtest_main
- test/gtest-typed-test2_test.cc)
- cxx_test(gtest_unittest gtest_main)
- cxx_test(gtest-unittest-api_test gtest)
-
-
-
- if (NOT MSVC OR MSVC_VERSION GREATER 1310)
- cxx_library(gtest_no_exception "${cxx_no_exception}"
- src/gtest-all.cc)
- cxx_library(gtest_main_no_exception "${cxx_no_exception}"
- src/gtest-all.cc src/gtest_main.cc)
- endif()
- cxx_library(gtest_main_no_rtti "${cxx_no_rtti}"
- src/gtest-all.cc src/gtest_main.cc)
- cxx_test_with_flags(gtest-death-test_ex_nocatch_test
- "${cxx_exception} -DGTEST_ENABLE_CATCH_EXCEPTIONS_=0"
- gtest test/gtest-death-test_ex_test.cc)
- cxx_test_with_flags(gtest-death-test_ex_catch_test
- "${cxx_exception} -DGTEST_ENABLE_CATCH_EXCEPTIONS_=1"
- gtest test/gtest-death-test_ex_test.cc)
- cxx_test_with_flags(gtest_no_rtti_unittest "${cxx_no_rtti}"
- gtest_main_no_rtti test/gtest_unittest.cc)
- cxx_shared_library(gtest_dll "${cxx_default}"
- src/gtest-all.cc src/gtest_main.cc)
- cxx_executable_with_flags(gtest_dll_test_ "${cxx_default}"
- gtest_dll test/gtest_all_test.cc)
- set_target_properties(gtest_dll_test_
- PROPERTIES
- COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1")
- if (NOT MSVC OR MSVC_VERSION LESS 1600)
-
-
-
- cxx_library(gtest_main_use_own_tuple "${cxx_use_own_tuple}"
- src/gtest-all.cc src/gtest_main.cc)
- cxx_test_with_flags(gtest-tuple_test "${cxx_use_own_tuple}"
- gtest_main_use_own_tuple test/gtest-tuple_test.cc)
- cxx_test_with_flags(gtest_use_own_tuple_test "${cxx_use_own_tuple}"
- gtest_main_use_own_tuple
- test/gtest-param-test_test.cc test/gtest-param-test2_test.cc)
- endif()
-
-
- cxx_executable(gtest_break_on_failure_unittest_ test gtest)
- py_test(gtest_break_on_failure_unittest)
-
- if (NOT MSVC OR MSVC_VERSION GREATER 1310)
- cxx_executable_with_flags(
- gtest_catch_exceptions_no_ex_test_
- "${cxx_no_exception}"
- gtest_main_no_exception
- test/gtest_catch_exceptions_test_.cc)
- endif()
- cxx_executable_with_flags(
- gtest_catch_exceptions_ex_test_
- "${cxx_exception}"
- gtest_main
- test/gtest_catch_exceptions_test_.cc)
- py_test(gtest_catch_exceptions_test)
- cxx_executable(gtest_color_test_ test gtest)
- py_test(gtest_color_test)
- cxx_executable(gtest_env_var_test_ test gtest)
- py_test(gtest_env_var_test)
- cxx_executable(gtest_filter_unittest_ test gtest)
- py_test(gtest_filter_unittest)
- cxx_executable(gtest_help_test_ test gtest_main)
- py_test(gtest_help_test)
- cxx_executable(gtest_list_tests_unittest_ test gtest)
- py_test(gtest_list_tests_unittest)
- cxx_executable(gtest_output_test_ test gtest)
- py_test(gtest_output_test)
- cxx_executable(gtest_shuffle_test_ test gtest)
- py_test(gtest_shuffle_test)
-
- if (NOT MSVC OR MSVC_VERSION GREATER 1310)
- cxx_executable(gtest_throw_on_failure_test_ test gtest_no_exception)
- set_target_properties(gtest_throw_on_failure_test_
- PROPERTIES
- COMPILE_FLAGS "${cxx_no_exception}")
- py_test(gtest_throw_on_failure_test)
- endif()
- cxx_executable(gtest_uninitialized_test_ test gtest)
- py_test(gtest_uninitialized_test)
- cxx_executable(gtest_xml_outfile1_test_ test gtest_main)
- cxx_executable(gtest_xml_outfile2_test_ test gtest_main)
- py_test(gtest_xml_outfiles_test)
- cxx_executable(gtest_xml_output_unittest_ test gtest)
- py_test(gtest_xml_output_unittest)
- endif()
|