1
0
Fork 0
mirror of https://github.com/TheLartians/ModernCppStarter.git synced 2025-09-06 00:41:01 +02:00

only apply tools for top-level directory

This commit is contained in:
Lars Melchior 2020-04-29 10:12:57 +02:00
parent 373d3c1651
commit c74c3a13b1
4 changed files with 16 additions and 14 deletions

View file

@ -1,16 +1,16 @@
# this file contains a list of tools that can be activated and downloaded on-demand
# each tool is enabled during configuration by passing an additional `-DUSE_<TOOL>=<VALUE>` argument to CMake
# determine if a tool has already been enabled
foreach(TOOL USE_SANITIZER;USE_CCACHE)
get_property(${TOOL}_ENABLED GLOBAL "" PROPERTY ${TOOL}_ENABLED SET)
endforeach()
# only activate tools for top level project
if (NOT PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
return()
endif()
include(${CMAKE_CURRENT_LIST_DIR}/CPM.cmake)
# enables sanitizers support using the the `USE_SANITIZER` flag
# available values are: Address, Memory, MemoryWithOrigins, Undefined, Thread, Leak, 'Address;Undefined'
if (USE_SANITIZER AND NOT USE_SANITIZER_ENABLED)
set_property(GLOBAL PROPERTY USE_SANITIZER_ENABLED true)
if (USE_SANITIZER)
CPMAddPackage(
NAME StableCoder-cmake-scripts
GITHUB_REPOSITORY StableCoder/cmake-scripts
@ -22,9 +22,7 @@ endif()
# enables CCACHE support through the USE_CCACHE flag
# possible values are: YES, NO or equivalent
if (USE_CCACHE AND NOT USE_CCACHE_ENABLED)
set_property(GLOBAL PROPERTY USE_CCACHE_ENABLED true)
if (USE_CCACHE)
CPMAddPackage(
NAME Ccache.cmake
GITHUB_REPOSITORY TheLartians/Ccache.cmake