Merge pull request #4382 from idzm:fix_cmake_comments

PiperOrigin-RevId: 570161165
Change-Id: Idf7eafb163bb067b0031e25a183d5c9cc3e3f378
This commit is contained in:
Copybara-Service 2023-10-02 13:30:23 -07:00
commit a6d7fa8c0c
4 changed files with 42 additions and 42 deletions

View File

@ -15,7 +15,7 @@ enable_testing()
include(CMakeDependentOption) include(CMakeDependentOption)
include(GNUInstallDirs) include(GNUInstallDirs)
#Note that googlemock target already builds googletest # Note that googlemock target already builds googletest.
option(BUILD_GMOCK "Builds the googlemock subproject" ON) option(BUILD_GMOCK "Builds the googlemock subproject" ON)
option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON) option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON)
option(GTEST_HAS_ABSL "Use Abseil and RE2. Requires Abseil and RE2 to be separately added to the build." OFF) option(GTEST_HAS_ABSL "Use Abseil and RE2. Requires Abseil and RE2 to be separately added to the build." OFF)

View File

@ -111,7 +111,7 @@ target_include_directories(gmock_main SYSTEM INTERFACE
######################################################################## ########################################################################
# #
# Install rules # Install rules.
install_project(gmock gmock_main) install_project(gmock gmock_main)
######################################################################## ########################################################################

View File

@ -35,7 +35,7 @@ endif()
######################################################################## ########################################################################
# #
# Project-wide settings # Project-wide settings.
# Name of the project. # Name of the project.
# #
@ -44,7 +44,7 @@ endif()
# ${gtest_BINARY_DIR}. # ${gtest_BINARY_DIR}.
# Language "C" is required for find_package(Threads). # Language "C" is required for find_package(Threads).
# Project version: # Project version.
cmake_minimum_required(VERSION 3.13) cmake_minimum_required(VERSION 3.13)
project(gtest VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C) project(gtest VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C)
@ -53,7 +53,7 @@ if (COMMAND set_up_hermetic_build)
set_up_hermetic_build() set_up_hermetic_build()
endif() endif()
# These commands only run if this is the main project # These commands only run if this is the main project.
if(CMAKE_PROJECT_NAME STREQUAL "gtest" OR CMAKE_PROJECT_NAME STREQUAL "googletest-distribution") if(CMAKE_PROJECT_NAME STREQUAL "gtest" OR CMAKE_PROJECT_NAME STREQUAL "googletest-distribution")
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to # BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to
@ -83,7 +83,7 @@ include(cmake/internal_utils.cmake)
config_compiler_and_linker() # Defined in internal_utils.cmake. config_compiler_and_linker() # Defined in internal_utils.cmake.
# Needed to set the namespace for both the export targets and the # Needed to set the namespace for both the export targets and the
# alias libraries # alias libraries.
set(cmake_package_name GTest CACHE INTERNAL "") set(cmake_package_name GTest CACHE INTERNAL "")
# Create the CMake package file descriptors. # Create the CMake package file descriptors.
@ -154,7 +154,7 @@ target_link_libraries(gtest_main PUBLIC gtest)
######################################################################## ########################################################################
# #
# Install rules # Install rules.
install_project(gtest gtest_main) install_project(gtest gtest_main)
######################################################################## ########################################################################

View File

@ -59,7 +59,7 @@ endmacro()
# variable's value is empty before it's explicitly assigned to. # variable's value is empty before it's explicitly assigned to.
macro(config_compiler_and_linker) macro(config_compiler_and_linker)
# Note: pthreads on MinGW is not supported, even if available # Note: pthreads on MinGW is not supported, even if available
# instead, we use windows threading primitives # instead, we use windows threading primitives.
unset(GTEST_HAS_PTHREAD) unset(GTEST_HAS_PTHREAD)
if (NOT gtest_disable_pthreads AND NOT MINGW) if (NOT gtest_disable_pthreads AND NOT MINGW)
# Defines CMAKE_USE_PTHREADS_INIT and CMAKE_THREAD_LIBS_INIT. # Defines CMAKE_USE_PTHREADS_INIT and CMAKE_THREAD_LIBS_INIT.
@ -79,7 +79,7 @@ macro(config_compiler_and_linker)
set(cxx_exception_flags "-EHsc -D_HAS_EXCEPTIONS=1") set(cxx_exception_flags "-EHsc -D_HAS_EXCEPTIONS=1")
set(cxx_no_exception_flags "-EHs-c- -D_HAS_EXCEPTIONS=0") set(cxx_no_exception_flags "-EHs-c- -D_HAS_EXCEPTIONS=0")
set(cxx_no_rtti_flags "-GR-") set(cxx_no_rtti_flags "-GR-")
# Suppress "unreachable code" warning # Suppress "unreachable code" warning,
# https://stackoverflow.com/questions/3232669 explains the issue. # https://stackoverflow.com/questions/3232669 explains the issue.
set(cxx_base_flags "${cxx_base_flags} -wd4702") set(cxx_base_flags "${cxx_base_flags} -wd4702")
# Ensure MSVC treats source files as UTF-8 encoded. # Ensure MSVC treats source files as UTF-8 encoded.
@ -167,7 +167,7 @@ function(cxx_library_with_type name type cxx_flags)
set_target_properties(${name} set_target_properties(${name}
PROPERTIES PROPERTIES
COMPILE_FLAGS "${cxx_flags}") COMPILE_FLAGS "${cxx_flags}")
# Set the output directory for build artifacts # Set the output directory for build artifacts.
set_target_properties(${name} set_target_properties(${name}
PROPERTIES PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
@ -175,7 +175,7 @@ function(cxx_library_with_type name type cxx_flags)
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
# make PDBs match library name # Make PDBs match library name.
get_target_property(pdb_debug_postfix ${name} DEBUG_POSTFIX) get_target_property(pdb_debug_postfix ${name} DEBUG_POSTFIX)
set_target_properties(${name} set_target_properties(${name}
PROPERTIES PROPERTIES
@ -212,7 +212,7 @@ endfunction()
# cxx_executable_with_flags(name cxx_flags libs srcs...) # cxx_executable_with_flags(name cxx_flags libs srcs...)
# #
# creates a named C++ executable that depends on the given libraries and # Creates a named C++ executable that depends on the given libraries and
# is built from the given source files with the given compiler flags. # is built from the given source files with the given compiler flags.
function(cxx_executable_with_flags name cxx_flags libs) function(cxx_executable_with_flags name cxx_flags libs)
add_executable(${name} ${ARGN}) add_executable(${name} ${ARGN})
@ -239,7 +239,7 @@ endfunction()
# cxx_executable(name dir lib srcs...) # cxx_executable(name dir lib srcs...)
# #
# creates a named target that depends on the given libs and is built # Creates a named target that depends on the given libs and is built
# from the given source files. dir/name.cc is implicitly included in # from the given source files. dir/name.cc is implicitly included in
# the source file list. # the source file list.
function(cxx_executable name dir libs) function(cxx_executable name dir libs)
@ -251,7 +251,7 @@ find_package(Python3)
# cxx_test_with_flags(name cxx_flags libs srcs...) # cxx_test_with_flags(name cxx_flags libs srcs...)
# #
# creates a named C++ test that depends on the given libs and is built # Creates a named C++ test that depends on the given libs and is built
# from the given source files with the given compiler flags. # from the given source files with the given compiler flags.
function(cxx_test_with_flags name cxx_flags libs) function(cxx_test_with_flags name cxx_flags libs)
cxx_executable_with_flags(${name} "${cxx_flags}" "${libs}" ${ARGN}) cxx_executable_with_flags(${name} "${cxx_flags}" "${libs}" ${ARGN})
@ -260,7 +260,7 @@ endfunction()
# cxx_test(name libs srcs...) # cxx_test(name libs srcs...)
# #
# creates a named test target that depends on the given libs and is # Creates a named test target that depends on the given libs and is
# built from the given source files. Unlike cxx_test_with_flags, # built from the given source files. Unlike cxx_test_with_flags,
# test/name.cc is already implicitly included in the source file list. # test/name.cc is already implicitly included in the source file list.
function(cxx_test name libs) function(cxx_test name libs)
@ -270,7 +270,7 @@ endfunction()
# py_test(name) # py_test(name)
# #
# creates a Python test with the given name whose main module is in # Creates a Python test with the given name whose main module is in
# test/name.py. It does nothing if Python is not installed. # test/name.py. It does nothing if Python is not installed.
function(py_test name) function(py_test name)
if (NOT Python3_Interpreter_FOUND) if (NOT Python3_Interpreter_FOUND)
@ -307,7 +307,7 @@ function(install_project)
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
# Install PDBs # Install PDBs.
foreach(t ${ARGN}) foreach(t ${ARGN})
get_target_property(t_pdb_name ${t} COMPILE_PDB_NAME) get_target_property(t_pdb_name ${t} COMPILE_PDB_NAME)
get_target_property(t_pdb_name_debug ${t} COMPILE_PDB_NAME_DEBUG) get_target_property(t_pdb_name_debug ${t} COMPILE_PDB_NAME_DEBUG)