summaryrefslogtreecommitdiffstats
path: root/Modules/FindGTest.cmake
diff options
context:
space:
mode:
authorMatthew Woehlke <matthew.woehlke@kitware.com>2017-09-15 16:53:16 (GMT)
committerMatthew Woehlke <matthew.woehlke@kitware.com>2017-09-18 14:01:36 (GMT)
commite2cca9f8ee04e9c775aee2276dd7122dcabf5dc4 (patch)
tree10b5fca75840fb2dd999094d2d3ce4c5dbee1959 /Modules/FindGTest.cmake
parent4636c64bfe71ceaad7991dfc3a397b721a578363 (diff)
downloadCMake-e2cca9f8ee04e9c775aee2276dd7122dcabf5dc4.zip
CMake-e2cca9f8ee04e9c775aee2276dd7122dcabf5dc4.tar.gz
CMake-e2cca9f8ee04e9c775aee2276dd7122dcabf5dc4.tar.bz2
FindGTest: Avoid macro name collision
Use two _'s for private function/macro names rather than one. This avoids a potential collision if a function/macro with no leading _ that otherwise matches the name of a private function/macro also overrides a built-in function or is defined twice.
Diffstat (limited to 'Modules/FindGTest.cmake')
-rw-r--r--Modules/FindGTest.cmake52
1 files changed, 26 insertions, 26 deletions
diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake
index 4543857..b0579d9 100644
--- a/Modules/FindGTest.cmake
+++ b/Modules/FindGTest.cmake
@@ -75,7 +75,7 @@
include(${CMAKE_CURRENT_LIST_DIR}/GoogleTest.cmake)
-function(_gtest_append_debugs _endvar _library)
+function(__gtest_append_debugs _endvar _library)
if(${_library} AND ${_library}_DEBUG)
set(_output optimized ${${_library}} debug ${${_library}_DEBUG})
else()
@@ -84,7 +84,7 @@ function(_gtest_append_debugs _endvar _library)
set(${_endvar} ${_output} PARENT_SCOPE)
endfunction()
-function(_gtest_find_library _name)
+function(__gtest_find_library _name)
find_library(${_name}
NAMES ${ARGN}
HINTS
@@ -95,7 +95,7 @@ function(_gtest_find_library _name)
mark_as_advanced(${_name})
endfunction()
-macro(_gtest_determine_windows_library_type _var)
+macro(__gtest_determine_windows_library_type _var)
if(EXISTS "${${_var}}")
file(TO_NATIVE_PATH "${${_var}}" _lib_path)
get_filename_component(_name "${${_var}}" NAME_WE)
@@ -109,18 +109,18 @@ macro(_gtest_determine_windows_library_type _var)
endif()
endmacro()
-function(_gtest_determine_library_type _var)
+function(__gtest_determine_library_type _var)
if(WIN32)
# For now, at least, only Windows really needs to know the library type
- _gtest_determine_windows_library_type(${_var})
- _gtest_determine_windows_library_type(${_var}_RELEASE)
- _gtest_determine_windows_library_type(${_var}_DEBUG)
+ __gtest_determine_windows_library_type(${_var})
+ __gtest_determine_windows_library_type(${_var}_RELEASE)
+ __gtest_determine_windows_library_type(${_var}_DEBUG)
endif()
# If we get here, no determination was made from the above checks
set(${_var}_TYPE UNKNOWN PARENT_SCOPE)
endfunction()
-function(_gtest_import_library _target _var _config)
+function(__gtest_import_library _target _var _config)
if(_config)
set(_config_suffix "_${_config}")
else()
@@ -181,15 +181,15 @@ mark_as_advanced(GTEST_INCLUDE_DIR)
if(MSVC AND GTEST_MSVC_SEARCH STREQUAL "MD")
# The provided /MD project files for Google Test add -md suffixes to the
# library names.
- _gtest_find_library(GTEST_LIBRARY gtest-md gtest)
- _gtest_find_library(GTEST_LIBRARY_DEBUG gtest-mdd gtestd)
- _gtest_find_library(GTEST_MAIN_LIBRARY gtest_main-md gtest_main)
- _gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_main-mdd gtest_maind)
+ __gtest_find_library(GTEST_LIBRARY gtest-md gtest)
+ __gtest_find_library(GTEST_LIBRARY_DEBUG gtest-mdd gtestd)
+ __gtest_find_library(GTEST_MAIN_LIBRARY gtest_main-md gtest_main)
+ __gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_main-mdd gtest_maind)
else()
- _gtest_find_library(GTEST_LIBRARY gtest)
- _gtest_find_library(GTEST_LIBRARY_DEBUG gtestd)
- _gtest_find_library(GTEST_MAIN_LIBRARY gtest_main)
- _gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_maind)
+ __gtest_find_library(GTEST_LIBRARY gtest)
+ __gtest_find_library(GTEST_LIBRARY_DEBUG gtestd)
+ __gtest_find_library(GTEST_MAIN_LIBRARY gtest_main)
+ __gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_maind)
endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
@@ -197,14 +197,14 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTest DEFAULT_MSG GTEST_LIBRARY GTEST_INCLUDE_
if(GTEST_FOUND)
set(GTEST_INCLUDE_DIRS ${GTEST_INCLUDE_DIR})
- _gtest_append_debugs(GTEST_LIBRARIES GTEST_LIBRARY)
- _gtest_append_debugs(GTEST_MAIN_LIBRARIES GTEST_MAIN_LIBRARY)
+ __gtest_append_debugs(GTEST_LIBRARIES GTEST_LIBRARY)
+ __gtest_append_debugs(GTEST_MAIN_LIBRARIES GTEST_MAIN_LIBRARY)
set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
find_package(Threads QUIET)
if(NOT TARGET GTest::GTest)
- _gtest_determine_library_type(GTEST_LIBRARY)
+ __gtest_determine_library_type(GTEST_LIBRARY)
add_library(GTest::GTest ${GTEST_LIBRARY_TYPE} IMPORTED)
if(TARGET Threads::Threads)
set_target_properties(GTest::GTest PROPERTIES
@@ -218,17 +218,17 @@ if(GTEST_FOUND)
set_target_properties(GTest::GTest PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIRS}")
endif()
- _gtest_import_library(GTest::GTest GTEST_LIBRARY "")
- _gtest_import_library(GTest::GTest GTEST_LIBRARY "RELEASE")
- _gtest_import_library(GTest::GTest GTEST_LIBRARY "DEBUG")
+ __gtest_import_library(GTest::GTest GTEST_LIBRARY "")
+ __gtest_import_library(GTest::GTest GTEST_LIBRARY "RELEASE")
+ __gtest_import_library(GTest::GTest GTEST_LIBRARY "DEBUG")
endif()
if(NOT TARGET GTest::Main)
- _gtest_determine_library_type(GTEST_MAIN_LIBRARY)
+ __gtest_determine_library_type(GTEST_MAIN_LIBRARY)
add_library(GTest::Main ${GTEST_MAIN_LIBRARY_TYPE} IMPORTED)
set_target_properties(GTest::Main PROPERTIES
INTERFACE_LINK_LIBRARIES "GTest::GTest")
- _gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "")
- _gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "RELEASE")
- _gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "DEBUG")
+ __gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "")
+ __gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "RELEASE")
+ __gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "DEBUG")
endif()
endif()