mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -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)
|
project(GSL VERSION 3.1.0 LANGUAGES CXX)
|
||||||
|
|
||||||
include(ExternalProject)
|
|
||||||
find_package(Git)
|
|
||||||
|
|
||||||
# Use GNUInstallDirs to provide the right locations on all platforms
|
# Use GNUInstallDirs to provide the right locations on all platforms
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
@ -51,21 +48,8 @@ else()
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Add natvis file
|
||||||
if (CMAKE_VERSION VERSION_GREATER 3.7.8)
|
gsl_add_native_visualizer_support()
|
||||||
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()
|
|
||||||
|
|
||||||
install(TARGETS GSL EXPORT Microsoft.GSLConfig)
|
install(TARGETS GSL EXPORT Microsoft.GSLConfig)
|
||||||
install(
|
install(
|
||||||
@ -104,4 +88,4 @@ if (GSL_TEST)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
endif ()
|
endif()
|
||||||
|
@ -59,3 +59,19 @@ function(gsl_client_set_cxx_standard min_cxx_standard)
|
|||||||
# Otherwise pick a reasonable default
|
# Otherwise pick a reasonable default
|
||||||
gsl_set_default_cxx_standard(${min_cxx_standard})
|
gsl_set_default_cxx_standard(${min_cxx_standard})
|
||||||
endfunction()
|
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)
|
cmake_minimum_required(VERSION 3.0.2)
|
||||||
|
|
||||||
project(GSLTests CXX)
|
project(GSLTests CXX)
|
||||||
|
|
||||||
include(FindPkgConfig)
|
include(FindPkgConfig)
|
||||||
|
include(ExternalProject)
|
||||||
|
|
||||||
|
find_package(Git REQUIRED QUIET)
|
||||||
|
|
||||||
# will make visual studio generated project group files
|
# will make visual studio generated project group files
|
||||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
Loading…
Reference in New Issue
Block a user