Renaming our gtest targets to gtest_ycm

llvm also has a copy of gtest in its source tree. This causes cmake to bork
since it sees several different targets with the same name (gtest and
gtest_main). So we have to rename our versions of gtest and gtest_main to
something else... We're just appending _ycm now.

This will cause pain when we want to update gtest in the future from upstream,
but I don't see a better way of handling this.
This commit is contained in:
Strahinja Val Markovic 2012-07-05 17:59:32 -07:00
parent 5f4da9324a
commit ac1f40b9af
3 changed files with 58 additions and 58 deletions

View File

@ -31,8 +31,8 @@ include_directories(
include_directories( include_directories(
SYSTEM SYSTEM
${gtest_SOURCE_DIR} ${gtest_ycm_SOURCE_DIR}
${gtest_SOURCE_DIR}/include ${gtest_ycm_SOURCE_DIR}/include
${gmock_SOURCE_DIR} ${gmock_SOURCE_DIR}
${gmock_SOURCE_DIR}/include ${gmock_SOURCE_DIR}/include
) )

View File

@ -58,10 +58,10 @@ config_compiler_and_linker() # from ${gtest_dir}/cmake/internal_utils.cmake
# Adds Google Mock's and Google Test's header directories to the search path. # Adds Google Mock's and Google Test's header directories to the search path.
include_directories("${gmock_SOURCE_DIR}/include" include_directories("${gmock_SOURCE_DIR}/include"
"${gmock_SOURCE_DIR}" "${gmock_SOURCE_DIR}"
"${gtest_SOURCE_DIR}/include" "${gtest_ycm_SOURCE_DIR}/include"
# This directory is needed to build directly from Google # This directory is needed to build directly from Google
# Test sources. # Test sources.
"${gtest_SOURCE_DIR}") "${gtest_ycm_SOURCE_DIR}")
######################################################################## ########################################################################
# #

View File

@ -39,7 +39,7 @@ endif()
# as ${gtest_SOURCE_DIR} and to the root binary directory as # as ${gtest_SOURCE_DIR} and to the root binary directory as
# ${gtest_BINARY_DIR}. # ${gtest_BINARY_DIR}.
# Language "C" is required for find_package(Threads). # Language "C" is required for find_package(Threads).
project(gtest CXX C) project(gtest_ycm CXX C)
cmake_minimum_required(VERSION 2.6.2) cmake_minimum_required(VERSION 2.6.2)
if (COMMAND set_up_hermetic_build) if (COMMAND set_up_hermetic_build)
@ -53,11 +53,11 @@ config_compiler_and_linker() # Defined in internal_utils.cmake.
# Where Google Test's .h files can be found. # Where Google Test's .h files can be found.
include_directories( include_directories(
${gtest_SOURCE_DIR}/include ${gtest_ycm_SOURCE_DIR}/include
${gtest_SOURCE_DIR}) ${gtest_ycm_SOURCE_DIR})
# Where Google Test's libraries can be found. # Where Google Test's libraries can be found.
link_directories(${gtest_BINARY_DIR}/src) link_directories(${gtest_ycm_BINARY_DIR}/src)
######################################################################## ########################################################################
# #
@ -67,9 +67,9 @@ link_directories(${gtest_BINARY_DIR}/src)
# Google Test libraries. We build them using more strict warnings than what # Google Test libraries. We build them using more strict warnings than what
# are used for other targets, to ensure that gtest can be compiled by a user # are used for other targets, to ensure that gtest can be compiled by a user
# aggressive about warnings. # aggressive about warnings.
cxx_library(gtest "${cxx_strict}" src/gtest-all.cc) cxx_library(gtest_ycm "${cxx_strict}" src/gtest-all.cc)
cxx_library(gtest_main "${cxx_strict}" src/gtest_main.cc) cxx_library(gtest_ycm_main "${cxx_strict}" src/gtest_main.cc)
target_link_libraries(gtest_main gtest) target_link_libraries(gtest_ycm_main gtest_ycm)
######################################################################## ########################################################################
# #
@ -80,16 +80,16 @@ target_link_libraries(gtest_main gtest)
# or specifying the -Dbuild_gtest_samples=ON flag when running cmake. # or specifying the -Dbuild_gtest_samples=ON flag when running cmake.
if (gtest_build_samples) if (gtest_build_samples)
cxx_executable(sample1_unittest samples gtest_main samples/sample1.cc) cxx_executable(sample1_unittest samples gtest_ycm_main samples/sample1.cc)
cxx_executable(sample2_unittest samples gtest_main samples/sample2.cc) cxx_executable(sample2_unittest samples gtest_ycm_main samples/sample2.cc)
cxx_executable(sample3_unittest samples gtest_main) cxx_executable(sample3_unittest samples gtest_ycm_main)
cxx_executable(sample4_unittest samples gtest_main samples/sample4.cc) cxx_executable(sample4_unittest samples gtest_ycm_main samples/sample4.cc)
cxx_executable(sample5_unittest samples gtest_main samples/sample1.cc) cxx_executable(sample5_unittest samples gtest_ycm_main samples/sample1.cc)
cxx_executable(sample6_unittest samples gtest_main) cxx_executable(sample6_unittest samples gtest_ycm_main)
cxx_executable(sample7_unittest samples gtest_main) cxx_executable(sample7_unittest samples gtest_ycm_main)
cxx_executable(sample8_unittest samples gtest_main) cxx_executable(sample8_unittest samples gtest_ycm_main)
cxx_executable(sample9_unittest samples gtest) cxx_executable(sample9_unittest samples gtest_ycm)
cxx_executable(sample10_unittest samples gtest) cxx_executable(sample10_unittest samples gtest_ycm)
endif() endif()
######################################################################## ########################################################################
@ -111,31 +111,31 @@ if (gtest_build_tests)
############################################################ ############################################################
# C++ tests built with standard compiler flags. # C++ tests built with standard compiler flags.
cxx_test(gtest-death-test_test gtest_main) cxx_test(gtest-death-test_test gtest_ycm_main)
cxx_test(gtest_environment_test gtest) cxx_test(gtest_environment_test gtest_ycm)
cxx_test(gtest-filepath_test gtest_main) cxx_test(gtest-filepath_test gtest_ycm_main)
cxx_test(gtest-linked_ptr_test gtest_main) cxx_test(gtest-linked_ptr_test gtest_ycm_main)
cxx_test(gtest-listener_test gtest_main) cxx_test(gtest-listener_test gtest_ycm_main)
cxx_test(gtest_main_unittest gtest_main) cxx_test(gtest_main_unittest gtest_ycm_main)
cxx_test(gtest-message_test gtest_main) cxx_test(gtest-message_test gtest_ycm_main)
cxx_test(gtest_no_test_unittest gtest) cxx_test(gtest_no_test_unittest gtest_ycm)
cxx_test(gtest-options_test gtest_main) cxx_test(gtest-options_test gtest_ycm_main)
cxx_test(gtest-param-test_test gtest cxx_test(gtest-param-test_test gtest_ycm
test/gtest-param-test2_test.cc) test/gtest-param-test2_test.cc)
cxx_test(gtest-port_test gtest_main) cxx_test(gtest-port_test gtest_ycm_main)
cxx_test(gtest_pred_impl_unittest gtest_main) cxx_test(gtest_pred_impl_unittest gtest_ycm_main)
cxx_test(gtest-printers_test gtest_main) cxx_test(gtest-printers_test gtest_ycm_main)
cxx_test(gtest_prod_test gtest_main cxx_test(gtest_prod_test gtest_ycm_main
test/production.cc) test/production.cc)
cxx_test(gtest_repeat_test gtest) cxx_test(gtest_repeat_test gtest_ycm)
cxx_test(gtest_sole_header_test gtest_main) cxx_test(gtest_sole_header_test gtest_ycm_main)
cxx_test(gtest_stress_test gtest) cxx_test(gtest_stress_test gtest_ycm)
cxx_test(gtest-test-part_test gtest_main) cxx_test(gtest-test-part_test gtest_ycm_main)
cxx_test(gtest_throw_on_failure_ex_test gtest) cxx_test(gtest_throw_on_failure_ex_test gtest_ycm)
cxx_test(gtest-typed-test_test gtest_main cxx_test(gtest-typed-test_test gtest_ycm_main
test/gtest-typed-test2_test.cc) test/gtest-typed-test2_test.cc)
cxx_test(gtest_unittest gtest_main) cxx_test(gtest_unittest gtest_ycm_main)
cxx_test(gtest-unittest-api_test gtest) cxx_test(gtest-unittest-api_test gtest_ycm)
############################################################ ############################################################
# C++ tests built with non-standard compiler flags. # C++ tests built with non-standard compiler flags.
@ -152,10 +152,10 @@ if (gtest_build_tests)
cxx_test_with_flags(gtest-death-test_ex_nocatch_test cxx_test_with_flags(gtest-death-test_ex_nocatch_test
"${cxx_exception} -DGTEST_ENABLE_CATCH_EXCEPTIONS_=0" "${cxx_exception} -DGTEST_ENABLE_CATCH_EXCEPTIONS_=0"
gtest test/gtest-death-test_ex_test.cc) gtest_ycm test/gtest-death-test_ex_test.cc)
cxx_test_with_flags(gtest-death-test_ex_catch_test cxx_test_with_flags(gtest-death-test_ex_catch_test
"${cxx_exception} -DGTEST_ENABLE_CATCH_EXCEPTIONS_=1" "${cxx_exception} -DGTEST_ENABLE_CATCH_EXCEPTIONS_=1"
gtest test/gtest-death-test_ex_test.cc) gtest_ycm test/gtest-death-test_ex_test.cc)
cxx_test_with_flags(gtest_no_rtti_unittest "${cxx_no_rtti}" cxx_test_with_flags(gtest_no_rtti_unittest "${cxx_no_rtti}"
gtest_main_no_rtti test/gtest_unittest.cc) gtest_main_no_rtti test/gtest_unittest.cc)
@ -189,7 +189,7 @@ if (gtest_build_tests)
############################################################ ############################################################
# Python tests. # Python tests.
cxx_executable(gtest_break_on_failure_unittest_ test gtest) cxx_executable(gtest_break_on_failure_unittest_ test gtest_ycm)
py_test(gtest_break_on_failure_unittest) py_test(gtest_break_on_failure_unittest)
# MSVC 7.1 does not support STL with exceptions disabled. # MSVC 7.1 does not support STL with exceptions disabled.
@ -204,29 +204,29 @@ if (gtest_build_tests)
cxx_executable_with_flags( cxx_executable_with_flags(
gtest_catch_exceptions_ex_test_ gtest_catch_exceptions_ex_test_
"${cxx_exception}" "${cxx_exception}"
gtest_main gtest_ycm_main
test/gtest_catch_exceptions_test_.cc) test/gtest_catch_exceptions_test_.cc)
py_test(gtest_catch_exceptions_test) py_test(gtest_catch_exceptions_test)
cxx_executable(gtest_color_test_ test gtest) cxx_executable(gtest_color_test_ test gtest_ycm)
py_test(gtest_color_test) py_test(gtest_color_test)
cxx_executable(gtest_env_var_test_ test gtest) cxx_executable(gtest_env_var_test_ test gtest_ycm)
py_test(gtest_env_var_test) py_test(gtest_env_var_test)
cxx_executable(gtest_filter_unittest_ test gtest) cxx_executable(gtest_filter_unittest_ test gtest_ycm)
py_test(gtest_filter_unittest) py_test(gtest_filter_unittest)
cxx_executable(gtest_help_test_ test gtest_main) cxx_executable(gtest_help_test_ test gtest_ycm_main)
py_test(gtest_help_test) py_test(gtest_help_test)
cxx_executable(gtest_list_tests_unittest_ test gtest) cxx_executable(gtest_list_tests_unittest_ test gtest_ycm)
py_test(gtest_list_tests_unittest) py_test(gtest_list_tests_unittest)
cxx_executable(gtest_output_test_ test gtest) cxx_executable(gtest_output_test_ test gtest_ycm)
py_test(gtest_output_test) py_test(gtest_output_test)
cxx_executable(gtest_shuffle_test_ test gtest) cxx_executable(gtest_shuffle_test_ test gtest_ycm)
py_test(gtest_shuffle_test) py_test(gtest_shuffle_test)
# MSVC 7.1 does not support STL with exceptions disabled. # MSVC 7.1 does not support STL with exceptions disabled.
@ -238,13 +238,13 @@ if (gtest_build_tests)
py_test(gtest_throw_on_failure_test) py_test(gtest_throw_on_failure_test)
endif() endif()
cxx_executable(gtest_uninitialized_test_ test gtest) cxx_executable(gtest_uninitialized_test_ test gtest_ycm)
py_test(gtest_uninitialized_test) py_test(gtest_uninitialized_test)
cxx_executable(gtest_xml_outfile1_test_ test gtest_main) cxx_executable(gtest_xml_outfile1_test_ test gtest_ycm_main)
cxx_executable(gtest_xml_outfile2_test_ test gtest_main) cxx_executable(gtest_xml_outfile2_test_ test gtest_ycm_main)
py_test(gtest_xml_outfiles_test) py_test(gtest_xml_outfiles_test)
cxx_executable(gtest_xml_output_unittest_ test gtest) cxx_executable(gtest_xml_output_unittest_ test gtest_ycm)
py_test(gtest_xml_output_unittest) py_test(gtest_xml_output_unittest)
endif() endif()