mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-28 18:41:57 -05:00
Minor cmake changes (#961)
Abstract adding natvis file. Move call to find_package(Git) as well as making it required/quiet.
This commit is contained in:
parent
a6cef6bc6c
commit
d15cb5fdbe
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user