Skip to content

Commit

Permalink
Fixes from review.
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Lalancette <[email protected]>
  • Loading branch information
clalancette committed Jun 23, 2023
1 parent 6fad29b commit f709286
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 38 deletions.
34 changes: 13 additions & 21 deletions googlemock/CMakeLists.txt.upstream
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
########################################################################
# Note: CMake support is community-based. The maintainers do not use CMake
# internally.
#
# CMake build script for Google Mock.
#
# To run the tests for Google Mock itself on Linux, use 'make test' or
Expand Down Expand Up @@ -39,7 +42,7 @@ else()
cmake_policy(SET CMP0048 NEW)
project(gmock VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C)
endif()
cmake_minimum_required(VERSION 2.6.4)
cmake_minimum_required(VERSION 2.8.12)

if (COMMAND set_up_hermetic_build)
set_up_hermetic_build()
Expand All @@ -49,7 +52,7 @@ endif()
# targets to the current scope. We are placing Google Test's binary
# directory in a subdirectory of our own as VC compilation may break
# if they are the same (the default).
add_subdirectory("${gtest_dir}" "${gmock_BINARY_DIR}/gtest")
add_subdirectory("${gtest_dir}" "${gmock_BINARY_DIR}/${gtest_dir}")


# These commands only run if this is the main project
Expand Down Expand Up @@ -97,8 +100,10 @@ if (MSVC)
else()
cxx_library(gmock "${cxx_strict}" src/gmock-all.cc)
target_link_libraries(gmock PUBLIC gtest)
set_target_properties(gmock PROPERTIES VERSION ${GOOGLETEST_VERSION})
cxx_library(gmock_main "${cxx_strict}" src/gmock_main.cc)
target_link_libraries(gmock_main PUBLIC gmock)
set_target_properties(gmock_main PROPERTIES VERSION ${GOOGLETEST_VERSION})
endif()
# If the CMake version supports it, attach header directory information
# to the targets for when we are part of a parent build (ie being pulled
Expand Down Expand Up @@ -133,18 +138,12 @@ if (gmock_build_tests)
# 'make test' or ctest.
enable_testing()

if (WIN32)
file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/RunTest.ps1"
CONTENT
"$project_bin = \"${CMAKE_BINARY_DIR}/bin/$<CONFIG>\"
$env:Path = \"$project_bin;$env:Path\"
& $args")
elseif (MINGW)
file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/RunTest.ps1"
CONTENT
"$project_bin = (cygpath --windows ${CMAKE_BINARY_DIR}/bin)
$env:Path = \"$project_bin;$env:Path\"
& $args")
if (MINGW OR CYGWIN)
if (CMAKE_VERSION VERSION_LESS "2.8.12")
add_compile_options("-Wa,-mbig-obj")
else()
add_definitions("-Wa,-mbig-obj")
endif()
endif()

############################################################
Expand All @@ -154,15 +153,8 @@ $env:Path = \"$project_bin;$env:Path\"
cxx_test(gmock-cardinalities_test gmock_main)
cxx_test(gmock_ex_test gmock_main)
cxx_test(gmock-function-mocker_test gmock_main)
cxx_test(gmock-generated-actions_test gmock_main)
cxx_test(gmock-generated-function-mockers_test gmock_main)
cxx_test(gmock-generated-internal-utils_test gmock_main)
cxx_test(gmock-generated-matchers_test gmock_main)
cxx_test(gmock-internal-utils_test gmock_main)
cxx_test(gmock-matchers_test gmock_main)
if (MINGW)
target_compile_options(gmock-matchers_test PRIVATE "-Wa,-mbig-obj")
endif()
cxx_test(gmock-more-actions_test gmock_main)
cxx_test(gmock-nice-strict_test gmock_main)
cxx_test(gmock-port_test gmock_main)
Expand Down
1 change: 1 addition & 0 deletions googlemock/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
1.8.9000 = google/googletest@c6cb7e033591528a5fe2c63157a0d8ce927740dc + osrf commits
1.10.9000 = google/googletest@703bd9caab50b139428cea1aaff9974ebee5742e + osrf commits
1.11.9000 = google/googletest@e2239ee6043f73722e7aa812a459f54a28552929 + osrf commits
-->
<version>1.11.9000</version>
<description>The package provides GoogleMock.</description>
Expand Down
39 changes: 22 additions & 17 deletions googletest/CMakeLists.txt.upstream
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
########################################################################
# Note: CMake support is community-based. The maintainers do not use CMake
# internally.
#
# CMake build script for Google Test.
#
# To run the tests for Google Test itself on Linux, use 'make test' or
Expand Down Expand Up @@ -40,13 +43,17 @@ endif()
# as ${gtest_SOURCE_DIR} and to the root binary directory as
# ${gtest_BINARY_DIR}.
# Language "C" is required for find_package(Threads).

# Project version:

if (CMAKE_VERSION VERSION_LESS 3.0)
project(gtest CXX C)
set(PROJECT_VERSION ${GOOGLETEST_VERSION})
else()
cmake_policy(SET CMP0048 NEW)
project(gtest VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C)
endif()
cmake_minimum_required(VERSION 2.6.4)
cmake_minimum_required(VERSION 2.8.12)

if (POLICY CMP0063) # Visibility
cmake_policy(SET CMP0063 NEW)
Expand Down Expand Up @@ -85,15 +92,18 @@ include(cmake/internal_utils.cmake)

config_compiler_and_linker() # Defined in internal_utils.cmake.

# Needed to set the namespace for both the export targets and the
# alias libraries
set(cmake_package_name GTest CACHE INTERNAL "")

# Create the CMake package file descriptors.
if (INSTALL_GTEST)
include(CMakePackageConfigHelpers)
set(cmake_package_name GTest)
set(targets_export_name ${cmake_package_name}Targets CACHE INTERNAL "")
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated" CACHE INTERNAL "")
set(cmake_files_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${cmake_package_name}")
set(version_file "${generated_dir}/${cmake_package_name}ConfigVersion.cmake")
write_basic_package_version_file(${version_file} COMPATIBILITY AnyNewerVersion)
write_basic_package_version_file(${version_file} VERSION ${GOOGLETEST_VERSION} COMPATIBILITY AnyNewerVersion)
install(EXPORT ${targets_export_name}
NAMESPACE ${cmake_package_name}::
DESTINATION ${cmake_files_install_dir})
Expand All @@ -119,7 +129,9 @@ include_directories(${gtest_build_include_dirs})
# are used for other targets, to ensure that gtest can be compiled by a user
# aggressive about warnings.
cxx_library(gtest "${cxx_strict}" src/gtest-all.cc)
set_target_properties(gtest PROPERTIES VERSION ${GOOGLETEST_VERSION})
cxx_library(gtest_main "${cxx_strict}" src/gtest_main.cc)
set_target_properties(gtest_main PROPERTIES VERSION ${GOOGLETEST_VERSION})
# If the CMake version supports it, attach header directory information
# to the targets for when we are part of a parent build (ie being pulled
# in via add_subdirectory() rather than being a standalone build).
Expand Down Expand Up @@ -175,20 +187,6 @@ if (gtest_build_tests)
# 'make test' or ctest.
enable_testing()

if (WIN32)
file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/RunTest.ps1"
CONTENT
"$project_bin = \"${CMAKE_BINARY_DIR}/bin/$<CONFIG>\"
$env:Path = \"$project_bin;$env:Path\"
& $args")
elseif (MINGW)
file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/RunTest.ps1"
CONTENT
"$project_bin = (cygpath --windows ${CMAKE_BINARY_DIR}/bin)
$env:Path = \"$project_bin;$env:Path\"
& $args")
endif()

############################################################
# C++ tests built with standard compiler flags.

Expand Down Expand Up @@ -218,6 +216,7 @@ $env:Path = \"$project_bin;$env:Path\"
test/gtest-typed-test2_test.cc)
cxx_test(gtest_unittest gtest_main)
cxx_test(gtest-unittest-api_test gtest)
cxx_test(gtest_skip_in_environment_setup_test gtest_main)
cxx_test(gtest_skip_test gtest_main)

############################################################
Expand Down Expand Up @@ -258,6 +257,9 @@ $env:Path = \"$project_bin;$env:Path\"
cxx_executable(googletest-break-on-failure-unittest_ test gtest)
py_test(googletest-break-on-failure-unittest)

py_test(gtest_skip_check_output_test)
py_test(gtest_skip_environment_check_output_test)

# Visual Studio .NET 2003 does not support STL with exceptions disabled.
if (NOT MSVC OR MSVC_VERSION GREATER 1310) # 1310 is Visual Studio .NET 2003
cxx_executable_with_flags(
Expand Down Expand Up @@ -307,6 +309,9 @@ $env:Path = \"$project_bin;$env:Path\"
cxx_executable(googletest-uninitialized-test_ test gtest)
py_test(googletest-uninitialized-test)

cxx_executable(gtest_list_output_unittest_ test gtest)
py_test(gtest_list_output_unittest)

cxx_executable(gtest_xml_outfile1_test_ test gtest_main)
cxx_executable(gtest_xml_outfile2_test_ test gtest_main)
py_test(gtest_xml_outfiles_test)
Expand Down
1 change: 1 addition & 0 deletions googletest/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
1.8.9000 = google/googletest@c6cb7e033591528a5fe2c63157a0d8ce927740dc + osrf commits
1.10.9000 = google/googletest@703bd9caab50b139428cea1aaff9974ebee5742e + osrf commits
1.11.9000 = google/googletest@e2239ee6043f73722e7aa812a459f54a28552929 + osrf commits
-->
<version>1.11.9000</version>
<description>The package provides GoogleTest.</description>
Expand Down

0 comments on commit f709286

Please sign in to comment.