Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/GSL.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJordan Maples <jomaples@microsoft.com>2020-08-13 03:14:13 +0300
committerJordan Maples <jomaples@microsoft.com>2020-08-13 03:14:13 +0300
commit74968d3ef87004ac04b6586bfe75e98c693a4c7b (patch)
treebbd4e2b7bdaab7ce2468d0bbec156faf1e715104 /tests
parent4da6a264c41c77d8a968c0936688626471671d38 (diff)
parent0c80f51f7c5ae947411906ae5600d46d56e491bf (diff)
Merge branch 'master' into exception_fix_new_file
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt55
1 files changed, 30 insertions, 25 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 2bd1bbe..a4bd7e6 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,36 +1,41 @@
cmake_minimum_required(VERSION 3.0.2)
project(GSLTests CXX)
+include(FindPkgConfig)
# will make visual studio generated project group files
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
-configure_file(CMakeLists.txt.in googletest-download/CMakeLists.txt)
-execute_process(
- COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
- RESULT_VARIABLE result
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download
-)
-if(result)
- message(FATAL_ERROR "CMake step for googletest failed: ${result}")
-endif()
+pkg_search_module(GTestMain gtest_main)
+if (NOT GTestMain_FOUND)
+ configure_file(CMakeLists.txt.in googletest-download/CMakeLists.txt)
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
+ RESULT_VARIABLE result
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download
+ )
+ if(result)
+ message(FATAL_ERROR "CMake step for googletest failed: ${result}")
+ endif()
-execute_process(
- COMMAND ${CMAKE_COMMAND} --build .
- RESULT_VARIABLE result
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download
-)
-if(result)
- message(FATAL_ERROR "CMake step for googletest failed: ${result}")
-endif()
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} --build .
+ RESULT_VARIABLE result
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download
+ )
+ if(result)
+ message(FATAL_ERROR "CMake step for googletest failed: ${result}")
+ endif()
-set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
+ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
+ set(GTestMain_LIBRARIES gtest_main)
-add_subdirectory(
- ${CMAKE_CURRENT_BINARY_DIR}/googletest-src
- ${CMAKE_CURRENT_BINARY_DIR}/googletest-build
- EXCLUDE_FROM_ALL
-)
+ add_subdirectory(
+ ${CMAKE_CURRENT_BINARY_DIR}/googletest-src
+ ${CMAKE_CURRENT_BINARY_DIR}/googletest-build
+ EXCLUDE_FROM_ALL
+ )
+endif()
if (MSVC AND (GSL_CXX_STANDARD EQUAL 17))
set(GSL_CPLUSPLUS_OPT -Zc:__cplusplus -permissive-)
@@ -149,7 +154,7 @@ function(add_gsl_test name)
target_link_libraries(${name}
GSL
gsl_tests_config
- gtest_main
+ ${GTestMain_LIBRARIES}
)
add_test(
${name}
@@ -254,7 +259,7 @@ function(add_gsl_test_noexcept name)
target_link_libraries(${name}
GSL
gsl_tests_config_noexcept
- gtest_main
+ ${GTestMain_LIBRARIES}
)
add_test(
${name}