mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
87f9d76886
Some checks failed
CI_Android / Android (push) Has been cancelled
cmake_find_package / Build ${{ matrix.os }} (macos-latest) (push) Has been cancelled
cmake_find_package / Build ${{ matrix.os }} (ubuntu-latest) (push) Has been cancelled
Compiler Integration Tests / gcc (Debug, 14, 10) (push) Has been cancelled
Compiler Integration Tests / gcc (Debug, 14, 11) (push) Has been cancelled
Compiler Integration Tests / gcc (Debug, 14, 12) (push) Has been cancelled
Compiler Integration Tests / gcc (Debug, 17, 10) (push) Has been cancelled
Compiler Integration Tests / gcc (Debug, 17, 11) (push) Has been cancelled
Compiler Integration Tests / gcc (Debug, 17, 12) (push) Has been cancelled
Compiler Integration Tests / gcc (Debug, 20, 10) (push) Has been cancelled
Compiler Integration Tests / gcc (Debug, 20, 11) (push) Has been cancelled
Compiler Integration Tests / gcc (Debug, 20, 12) (push) Has been cancelled
Compiler Integration Tests / gcc (Debug, 23, 11) (push) Has been cancelled
Compiler Integration Tests / gcc (Debug, 23, 12) (push) Has been cancelled
Compiler Integration Tests / gcc (Release, 14, 10) (push) Has been cancelled
Compiler Integration Tests / gcc (Release, 14, 11) (push) Has been cancelled
Compiler Integration Tests / gcc (Release, 14, 12) (push) Has been cancelled
Compiler Integration Tests / gcc (Release, 17, 10) (push) Has been cancelled
Compiler Integration Tests / gcc (Release, 17, 11) (push) Has been cancelled
Compiler Integration Tests / gcc (Release, 17, 12) (push) Has been cancelled
Compiler Integration Tests / gcc (Release, 20, 10) (push) Has been cancelled
Compiler Integration Tests / gcc (Release, 20, 11) (push) Has been cancelled
Compiler Integration Tests / gcc (Release, 20, 12) (push) Has been cancelled
Compiler Integration Tests / gcc (Release, 23, 11) (push) Has been cancelled
Compiler Integration Tests / gcc (Release, 23, 12) (push) Has been cancelled
Compiler Integration Tests / clang (Debug, 13, 14) (push) Has been cancelled
Compiler Integration Tests / clang (Debug, 13, 17) (push) Has been cancelled
Compiler Integration Tests / clang (Debug, 13, 20) (push) Has been cancelled
Compiler Integration Tests / clang (Debug, 13, 23) (push) Has been cancelled
Compiler Integration Tests / clang (Debug, 14, 14) (push) Has been cancelled
Compiler Integration Tests / clang (Debug, 14, 17) (push) Has been cancelled
Compiler Integration Tests / clang (Debug, 14, 20) (push) Has been cancelled
Compiler Integration Tests / clang (Debug, 14, 23) (push) Has been cancelled
Compiler Integration Tests / clang (Debug, 15, 14) (push) Has been cancelled
Compiler Integration Tests / clang (Debug, 15, 17) (push) Has been cancelled
Compiler Integration Tests / clang (Debug, 15, 20) (push) Has been cancelled
Compiler Integration Tests / clang (Debug, 15, 23) (push) Has been cancelled
Compiler Integration Tests / clang (Release, 13, 14) (push) Has been cancelled
Compiler Integration Tests / clang (Release, 13, 17) (push) Has been cancelled
Compiler Integration Tests / clang (Release, 13, 20) (push) Has been cancelled
Compiler Integration Tests / clang (Release, 13, 23) (push) Has been cancelled
Compiler Integration Tests / clang (Release, 14, 14) (push) Has been cancelled
Compiler Integration Tests / clang (Release, 14, 17) (push) Has been cancelled
Compiler Integration Tests / clang (Release, 14, 20) (push) Has been cancelled
Compiler Integration Tests / clang (Release, 14, 23) (push) Has been cancelled
Compiler Integration Tests / clang (Release, 15, 14) (push) Has been cancelled
Compiler Integration Tests / clang (Release, 15, 17) (push) Has been cancelled
Compiler Integration Tests / clang (Release, 15, 20) (push) Has been cancelled
Compiler Integration Tests / clang (Release, 15, 23) (push) Has been cancelled
Compiler Integration Tests / xcode (Debug, 14, 14.3.1) (push) Has been cancelled
Compiler Integration Tests / xcode (Debug, 14, 15.4) (push) Has been cancelled
Compiler Integration Tests / xcode (Debug, 17, 14.3.1) (push) Has been cancelled
Compiler Integration Tests / xcode (Debug, 17, 15.4) (push) Has been cancelled
Compiler Integration Tests / xcode (Debug, 20, 14.3.1) (push) Has been cancelled
Compiler Integration Tests / xcode (Debug, 20, 15.4) (push) Has been cancelled
Compiler Integration Tests / xcode (Debug, 23, 14.3.1) (push) Has been cancelled
Compiler Integration Tests / xcode (Debug, 23, 15.4) (push) Has been cancelled
Compiler Integration Tests / xcode (Release, 14, 14.3.1) (push) Has been cancelled
Compiler Integration Tests / xcode (Release, 14, 15.4) (push) Has been cancelled
Compiler Integration Tests / xcode (Release, 17, 14.3.1) (push) Has been cancelled
Compiler Integration Tests / xcode (Release, 17, 15.4) (push) Has been cancelled
Compiler Integration Tests / xcode (Release, 20, 14.3.1) (push) Has been cancelled
Compiler Integration Tests / xcode (Release, 20, 15.4) (push) Has been cancelled
Compiler Integration Tests / xcode (Release, 23, 14.3.1) (push) Has been cancelled
Compiler Integration Tests / xcode (Release, 23, 15.4) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Debug, 14, , Visual Studio 16 2019, windows-2019) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Debug, 14, , Visual Studio 17 2022, windows-2022) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Debug, 14, -T ClangCL, Visual Studio 16 2019, windows-2019) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Debug, 14, -T ClangCL, Visual Studio 17 2022, windows-2022) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Debug, 17, , Visual Studio 16 2019, windows-2019) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Debug, 17, , Visual Studio 17 2022, windows-2022) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Debug, 17, -T ClangCL, Visual Studio 16 2019, windows-2019) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Debug, 17, -T ClangCL, Visual Studio 17 2022, windows-2022) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Debug, 20, , Visual Studio 16 2019, windows-2019) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Debug, 20, , Visual Studio 17 2022, windows-2022) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Debug, 20, -T ClangCL, Visual Studio 16 2019, windows-2019) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Debug, 20, -T ClangCL, Visual Studio 17 2022, windows-2022) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Debug, 23, , Visual Studio 17 2022, windows-2022) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Debug, 23, -T ClangCL, Visual Studio 17 2022, windows-2022) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Release, 14, , Visual Studio 16 2019, windows-2019) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Release, 14, , Visual Studio 17 2022, windows-2022) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Release, 14, -T ClangCL, Visual Studio 16 2019, windows-2019) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Release, 14, -T ClangCL, Visual Studio 17 2022, windows-2022) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Release, 17, , Visual Studio 16 2019, windows-2019) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Release, 17, , Visual Studio 17 2022, windows-2022) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Release, 17, -T ClangCL, Visual Studio 16 2019, windows-2019) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Release, 17, -T ClangCL, Visual Studio 17 2022, windows-2022) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Release, 20, , Visual Studio 16 2019, windows-2019) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Release, 20, , Visual Studio 17 2022, windows-2022) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Release, 20, -T ClangCL, Visual Studio 16 2019, windows-2019) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Release, 20, -T ClangCL, Visual Studio 17 2022, windows-2022) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Release, 23, , Visual Studio 17 2022, windows-2022) (push) Has been cancelled
Compiler Integration Tests / VisualStudio (Release, 23, -T ClangCL, Visual Studio 17 2022, windows-2022) (push) Has been cancelled
CI_iOS / iOS (push) Has been cancelled
Fixes: #1161 Update version strings in README and CMakeLists.txt.
49 lines
1.7 KiB
CMake
49 lines
1.7 KiB
CMake
cmake_minimum_required(VERSION 3.14...3.16)
|
|
|
|
project(GSL VERSION 4.1.0 LANGUAGES CXX)
|
|
|
|
add_library(GSL INTERFACE)
|
|
add_library(Microsoft.GSL::GSL ALIAS GSL)
|
|
|
|
# https://cmake.org/cmake/help/latest/variable/PROJECT_IS_TOP_LEVEL.html
|
|
string(COMPARE EQUAL ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR} PROJECT_IS_TOP_LEVEL)
|
|
|
|
option(GSL_INSTALL "Generate and install GSL target" ${PROJECT_IS_TOP_LEVEL})
|
|
option(GSL_TEST "Build and perform GSL tests" ${PROJECT_IS_TOP_LEVEL})
|
|
|
|
# The implementation generally assumes a platform that implements C++14 support
|
|
target_compile_features(GSL INTERFACE "cxx_std_14")
|
|
|
|
# Setup include directory
|
|
add_subdirectory(include)
|
|
|
|
target_sources(GSL INTERFACE $<BUILD_INTERFACE:${GSL_SOURCE_DIR}/GSL.natvis>)
|
|
|
|
if (GSL_TEST)
|
|
enable_testing()
|
|
add_subdirectory(tests)
|
|
endif()
|
|
|
|
if (GSL_INSTALL)
|
|
include(GNUInstallDirs)
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/gsl" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
|
|
set(export_name "Microsoft.GSLConfig")
|
|
set(namespace "Microsoft.GSL::")
|
|
set(cmake_files_install_dir ${CMAKE_INSTALL_DATADIR}/cmake/Microsoft.GSL)
|
|
|
|
install(TARGETS GSL EXPORT ${export_name} INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
install(EXPORT ${export_name} NAMESPACE ${namespace} DESTINATION ${cmake_files_install_dir})
|
|
export(TARGETS GSL NAMESPACE ${namespace} FILE ${export_name}.cmake)
|
|
|
|
set(gls_config_version "${CMAKE_CURRENT_BINARY_DIR}/Microsoft.GSLConfigVersion.cmake")
|
|
|
|
write_basic_package_version_file(${gls_config_version} COMPATIBILITY SameMajorVersion ARCH_INDEPENDENT)
|
|
|
|
install(FILES ${gls_config_version} DESTINATION ${cmake_files_install_dir})
|
|
|
|
install(FILES GSL.natvis DESTINATION ${cmake_files_install_dir})
|
|
endif()
|