@@ -46,15 +46,9 @@ endif()
46
46
47
47
# Project version:
48
48
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)
58
52
59
53
if (POLICY CMP0063) # Visibility
60
54
cmake_policy (SET CMP0063 NEW)
@@ -93,10 +87,13 @@ include(cmake/internal_utils.cmake)
93
87
94
88
config_compiler_and_linker() # Defined in internal_utils.cmake.
95
89
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
+
96
94
# Create the CMake package file descriptors.
97
95
if (INSTALL_GTEST)
98
96
include (CMakePackageConfigHelpers)
99
- set (cmake_package_name GTest)
100
97
set (targets_export_name ${cmake_package_name} Targets CACHE INTERNAL "" )
101
98
set (generated_dir "${CMAKE_CURRENT_BINARY_DIR} /generated" CACHE INTERNAL "" )
102
99
set (cmake_files_install_dir "${CMAKE_INSTALL_LIBDIR} /cmake/${cmake_package_name} " )
@@ -127,18 +124,24 @@ include_directories(${gtest_build_include_dirs})
127
124
# are used for other targets, to ensure that gtest can be compiled by a user
128
125
# aggressive about warnings.
129
126
cxx_library(gtest "${cxx_strict} " src/gtest-all .cc)
127
+ set_target_properties (gtest PROPERTIES VERSION ${GOOGLETEST_VERSION} )
130
128
cxx_library(gtest_main "${cxx_strict} " src/gtest_main.cc)
129
+ set_target_properties (gtest_main PROPERTIES VERSION ${GOOGLETEST_VERSION} )
131
130
# If the CMake version supports it, attach header directory information
132
131
# to the targets for when we are part of a parent build (ie being pulled
133
132
# in via add_subdirectory() rather than being a standalone build).
134
133
if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION} " VERSION_LESS "2.8.11" )
134
+ string (REPLACE ";" "$<SEMICOLON>" dirs "${gtest_build_include_dirs} " )
135
135
target_include_directories (gtest SYSTEM INTERFACE
136
- "$<BUILD_INTERFACE:${gtest_build_include_dirs } >"
136
+ "$<BUILD_INTERFACE:${dirs } >"
137
137
"$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR} >" )
138
138
target_include_directories (gtest_main SYSTEM INTERFACE
139
- "$<BUILD_INTERFACE:${gtest_build_include_dirs } >"
139
+ "$<BUILD_INTERFACE:${dirs } >"
140
140
"$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR} >" )
141
141
endif ()
142
+ if (CMAKE_SYSTEM_NAME MATCHES "QNX" )
143
+ target_link_libraries (gtest PUBLIC regex )
144
+ endif ()
142
145
target_link_libraries (gtest_main PUBLIC gtest)
143
146
144
147
########################################################################
@@ -183,20 +186,6 @@ if (gtest_build_tests)
183
186
# 'make test' or ctest.
184
187
enable_testing ()
185
188
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
-
200
189
############################################################
201
190
# C++ tests built with standard compiler flags.
202
191
@@ -267,6 +256,7 @@ $env:Path = \"$project_bin;$env:Path\"
267
256
cxx_executable(googletest-break-on -failure-unittest_ test gtest)
268
257
py_test(googletest-break-on -failure-unittest)
269
258
259
+ py_test(gtest_skip_check_output_test)
270
260
py_test(gtest_skip_environment_check_output_test)
271
261
272
262
# Visual Studio .NET 2003 does not support STL with exceptions disabled.
@@ -318,6 +308,9 @@ $env:Path = \"$project_bin;$env:Path\"
318
308
cxx_executable(googletest-uninitialized-test_ test gtest)
319
309
py_test(googletest-uninitialized-test )
320
310
311
+ cxx_executable(gtest_list_output_unittest_ test gtest)
312
+ py_test(gtest_list_output_unittest)
313
+
321
314
cxx_executable(gtest_xml_outfile1_test_ test gtest_main)
322
315
cxx_executable(gtest_xml_outfile2_test_ test gtest_main)
323
316
py_test(gtest_xml_outfiles_test)
0 commit comments