@@ -46,15 +46,9 @@ endif()
4646
4747# Project version:
4848
49- set (GOOGLETEST_VERSION "1.10.0" )
50- if (CMAKE_VERSION VERSION_LESS 3.0)
51- project (gtest CXX C )
52- set (PROJECT_VERSION ${GOOGLETEST_VERSION} )
53- else ()
54- cmake_policy (SET CMP0048 NEW )
55- project (gtest VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C )
56- endif ()
57- cmake_minimum_required (VERSION 2.6.4 )
49+ cmake_minimum_required (VERSION 3.5 )
50+ cmake_policy (SET CMP0048 NEW )
51+ project (gtest VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C )
5852
5953if (POLICY CMP0063) # Visibility
6054 cmake_policy (SET CMP0063 NEW )
@@ -93,10 +87,13 @@ include(cmake/internal_utils.cmake)
9387
9488config_compiler_and_linker () # Defined in internal_utils.cmake.
9589
90+ # Needed to set the namespace for both the export targets and the
91+ # alias libraries
92+ set (cmake_package_name GTest CACHE INTERNAL "" )
93+
9694# Create the CMake package file descriptors.
9795if (INSTALL_GTEST)
9896 include (CMakePackageConfigHelpers )
99- set (cmake_package_name GTest)
10097 set (targets_export_name ${cmake_package_name} Targets CACHE INTERNAL "" )
10198 set (generated_dir "${CMAKE_CURRENT_BINARY_DIR } /generated" CACHE INTERNAL "" )
10299 set (cmake_files_install_dir "${CMAKE_INSTALL_LIBDIR} /cmake/${cmake_package_name} " )
@@ -127,18 +124,24 @@ include_directories(${gtest_build_include_dirs})
127124# are used for other targets, to ensure that gtest can be compiled by a user
128125# aggressive about warnings.
129126cxx_library (gtest "${cxx_strict} " src/gtest-all.cc )
127+ set_target_properties (gtest PROPERTIES VERSION ${GOOGLETEST_VERSION} )
130128cxx_library (gtest_main "${cxx_strict} " src/gtest_main.cc )
129+ set_target_properties (gtest_main PROPERTIES VERSION ${GOOGLETEST_VERSION} )
131130# If the CMake version supports it, attach header directory information
132131# to the targets for when we are part of a parent build (ie being pulled
133132# in via add_subdirectory() rather than being a standalone build).
134133if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION } " VERSION_LESS "2.8.11" )
134+ string (REPLACE ";" "$<SEMICOLON >" dirs "${gtest_build_include_dirs} " )
135135 target_include_directories (gtest SYSTEM INTERFACE
136- "$<BUILD_INTERFACE :${gtest_build_include_dirs } >"
136+ "$<BUILD_INTERFACE :${dirs } >"
137137 "$<INSTALL_INTERFACE :$<INSTALL_PREFIX >/${CMAKE_INSTALL_INCLUDEDIR} >" )
138138 target_include_directories (gtest_main SYSTEM INTERFACE
139- "$<BUILD_INTERFACE :${gtest_build_include_dirs } >"
139+ "$<BUILD_INTERFACE :${dirs } >"
140140 "$<INSTALL_INTERFACE :$<INSTALL_PREFIX >/${CMAKE_INSTALL_INCLUDEDIR} >" )
141141endif ()
142+ if (CMAKE_SYSTEM_NAME MATCHES "QNX" )
143+ target_link_libraries (gtest PUBLIC regex )
144+ endif ()
142145target_link_libraries (gtest_main PUBLIC gtest )
143146
144147########################################################################
@@ -183,20 +186,6 @@ if (gtest_build_tests)
183186 # 'make test' or ctest.
184187 enable_testing ()
185188
186- if (WIN32 )
187- file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR } /$<CONFIG >/RunTest.ps1"
188- CONTENT
189- "$project_bin = \" ${CMAKE_BINARY_DIR } /bin/$<CONFIG >\"
190- $env:Path = \" $project_bin;$env:Path\"
191- & $args" )
192- elseif (MINGW OR CYGWIN )
193- file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR } /RunTest.ps1"
194- CONTENT
195- "$project_bin = (cygpath --windows ${CMAKE_BINARY_DIR } /bin)
196- $env:Path = \" $project_bin;$env:Path\"
197- & $args" )
198- endif ()
199-
200189 ############################################################
201190 # C++ tests built with standard compiler flags.
202191
@@ -267,6 +256,7 @@ $env:Path = \"$project_bin;$env:Path\"
267256 cxx_executable (googletest-break-on-failure-unittest_ test gtest )
268257 py_test (googletest-break-on-failure-unittest )
269258
259+ py_test (gtest_skip_check_output_test )
270260 py_test (gtest_skip_environment_check_output_test )
271261
272262 # Visual Studio .NET 2003 does not support STL with exceptions disabled.
@@ -318,6 +308,9 @@ $env:Path = \"$project_bin;$env:Path\"
318308 cxx_executable (googletest-uninitialized-test_ test gtest )
319309 py_test (googletest-uninitialized-test )
320310
311+ cxx_executable (gtest_list_output_unittest_ test gtest )
312+ py_test (gtest_list_output_unittest )
313+
321314 cxx_executable (gtest_xml_outfile1_test_ test gtest_main )
322315 cxx_executable (gtest_xml_outfile2_test_ test gtest_main )
323316 py_test (gtest_xml_outfiles_test )
0 commit comments