mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-04-29 20:23:55 +00:00
Minor build system improvements (#154)
This commit is contained in:
parent
92b8f6e3bf
commit
73411e1e38
@ -1,7 +1,13 @@
|
||||
cmake_minimum_required(VERSION 3.4...3.11)
|
||||
cmake_minimum_required(VERSION 3.4)
|
||||
# Note: this is a header only library. If you have an older CMake than 3.4,
|
||||
# just add the CLI11/include directory and that's all you need to do.
|
||||
|
||||
# Make sure users don't get warnings on a tested (3.4 to 3.12) version
|
||||
# of CMake. For most of the policies, the new version is better (hence the change).
|
||||
if(${CMAKE_VERSION} VERSION_LESS 3.12)
|
||||
cmake_policy(VERSION ${CMAKE_VERSION})
|
||||
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
|
||||
else()
|
||||
cmake_policy(VERSION 3.12)
|
||||
endif()
|
||||
|
||||
set(VERSION_REGEX "#define CLI11_VERSION[ \t]+\"(.+)\"")
|
||||
@ -13,10 +19,9 @@ file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/include/CLI/Version.hpp"
|
||||
# Pick out just the version
|
||||
string(REGEX REPLACE ${VERSION_REGEX} "\\1" VERSION_STRING "${VERSION_STRING}")
|
||||
|
||||
# Add the project
|
||||
project(CLI11 LANGUAGES CXX VERSION ${VERSION_STRING})
|
||||
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
||||
|
||||
# Only if built as the main project
|
||||
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
|
||||
# User settable
|
||||
|
@ -3,10 +3,12 @@ if(NOT EXISTS "${CLI11_SOURCE_DIR}/extern/googletest/CMakeLists.txt")
|
||||
git submodule update --init")
|
||||
endif()
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CLI11_SOURCE_DIR}/cmake")
|
||||
|
||||
# If submodule is available, add sanitizers
|
||||
# Set SANITIZE_ADDRESS, SANITIZE_MEMORY, SANITIZE_THREAD or SANITIZE_UNDEFINED
|
||||
if(EXISTS "${CLI11_SOURCE_DIR}/extern/sanitizers/cmake/FindSanitizers.cmake")
|
||||
set(CMAKE_MODULE_PATH "${CLI11_SOURCE_DIR}/extern/sanitizers/cmake" ${CMAKE_MODULE_PATH})
|
||||
list(APPEND CMAKE_MODULE_PATH "${CLI11_SOURCE_DIR}/extern/sanitizers/cmake")
|
||||
find_package(Sanitizers)
|
||||
if(SANITIZE_ADDRESS)
|
||||
message(STATUS "You might want to use \"${ASan_WRAPPER}\" to run your program")
|
||||
|
Loading…
x
Reference in New Issue
Block a user