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
diff options
context:
space:
mode:
authorhdf89shfdfs <31327577+hdf89shfdfs@users.noreply.github.com>2020-12-15 21:06:46 +0300
committerGitHub <noreply@github.com>2020-12-15 21:06:46 +0300
commitd15cb5fdbe0f9ef0cb896311891dbe7903bbe674 (patch)
treefceba9b8a702fed6cd37aef9081de130724ecbdb
parenta6cef6bc6c6daa4710cf0b6e5bcfd40a3908baa1 (diff)
Minor cmake changes (#961)
Abstract adding natvis file. Move call to find_package(Git) as well as making it required/quiet.
-rw-r--r--CMakeLists.txt22
-rw-r--r--cmake/guidelineSupportLibrary.cmake16
-rw-r--r--tests/CMakeLists.txt4
3 files changed, 23 insertions, 19 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f44425c..7ad13f7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,9 +5,6 @@ include(guidelineSupportLibrary)
project(GSL VERSION 3.1.0 LANGUAGES CXX)
-include(ExternalProject)
-find_package(Git)
-
# Use GNUInstallDirs to provide the right locations on all platforms
include(GNUInstallDirs)
@@ -51,21 +48,8 @@ else()
)
endif()
-
-if (CMAKE_VERSION VERSION_GREATER 3.7.8)
- if (MSVC_IDE)
- option(GSL_VS_ADD_NATIVE_VISUALIZERS "Configure project to use Visual Studio native visualizers" TRUE)
- else()
- set(GSL_VS_ADD_NATIVE_VISUALIZERS FALSE CACHE INTERNAL "Native visualizers are Visual Studio extension" FORCE)
- endif()
-
- # add natvis file to the library so it will automatically be loaded into Visual Studio
- if(GSL_VS_ADD_NATIVE_VISUALIZERS)
- target_sources(GSL INTERFACE
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/GSL.natvis>
- )
- endif()
-endif()
+# Add natvis file
+gsl_add_native_visualizer_support()
install(TARGETS GSL EXPORT Microsoft.GSLConfig)
install(
@@ -104,4 +88,4 @@ if (GSL_TEST)
)
endif()
add_subdirectory(tests)
-endif ()
+endif()
diff --git a/cmake/guidelineSupportLibrary.cmake b/cmake/guidelineSupportLibrary.cmake
index e29e80c..39d8920 100644
--- a/cmake/guidelineSupportLibrary.cmake
+++ b/cmake/guidelineSupportLibrary.cmake
@@ -59,3 +59,19 @@ function(gsl_client_set_cxx_standard min_cxx_standard)
# Otherwise pick a reasonable default
gsl_set_default_cxx_standard(${min_cxx_standard})
endfunction()
+
+# Adding the GSL.natvis files improves the debugging experience for users of this library.
+function(gsl_add_native_visualizer_support)
+ if (CMAKE_VERSION VERSION_GREATER 3.7.8)
+ if (MSVC_IDE)
+ option(GSL_VS_ADD_NATIVE_VISUALIZERS "Configure project to use Visual Studio native visualizers" TRUE)
+ else()
+ set(GSL_VS_ADD_NATIVE_VISUALIZERS FALSE CACHE INTERNAL "Native visualizers are Visual Studio extension" FORCE)
+ endif()
+
+ # add natvis file to the library so it will automatically be loaded into Visual Studio
+ if(GSL_VS_ADD_NATIVE_VISUALIZERS)
+ target_sources(GSL INTERFACE $<BUILD_INTERFACE:${GSL_SOURCE_DIR}/GSL.natvis>)
+ endif()
+ endif()
+endfunction()
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index c323961..2e7c2dc 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,7 +1,11 @@
cmake_minimum_required(VERSION 3.0.2)
project(GSLTests CXX)
+
include(FindPkgConfig)
+include(ExternalProject)
+
+find_package(Git REQUIRED QUIET)
# will make visual studio generated project group files
set_property(GLOBAL PROPERTY USE_FOLDERS ON)