mirror of
https://github.com/TheLartians/ModernCppStarter.git
synced 2025-08-30 13:41:13 +02:00
add cmake tools option to easy dynamic setup
This commit is contained in:
parent
2cf15bc347
commit
aa02116995
3 changed files with 14 additions and 2 deletions
|
@ -10,6 +10,10 @@ 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'
|
||||
set(USE_SANITIZER
|
||||
"Address;Undefined"
|
||||
CACHE STRING "one or more of: Address, Memory, MemoryWithOrigins, Undefined, Thread, Leak"
|
||||
)
|
||||
if(USE_SANITIZER OR USE_STATIC_ANALYZER)
|
||||
CPMAddPackage("gh:StableCoder/cmake-scripts#1f822d1fc87c8d7720c074cde8a278b44963c354")
|
||||
|
||||
|
@ -17,6 +21,10 @@ if(USE_SANITIZER OR USE_STATIC_ANALYZER)
|
|||
include(${cmake-scripts_SOURCE_DIR}/sanitizers.cmake)
|
||||
endif()
|
||||
|
||||
set(USE_STATIC_ANALYZER
|
||||
""
|
||||
CACHE STRING "one or more of: clang-tidy, iwyu, cppcheck"
|
||||
)
|
||||
if(USE_STATIC_ANALYZER)
|
||||
if("clang-tidy" IN_LIST USE_STATIC_ANALYZER)
|
||||
set(CLANG_TIDY
|
||||
|
@ -61,6 +69,7 @@ if(USE_SANITIZER OR USE_STATIC_ANALYZER)
|
|||
endif()
|
||||
|
||||
# enables CCACHE support through the USE_CCACHE flag possible values are: YES, NO or equivalent
|
||||
option(USE_CCACHE "enables ccache support" YES)
|
||||
if(USE_CCACHE)
|
||||
CPMAddPackage("gh:TheLartians/Ccache.cmake@1.2.3")
|
||||
endif()
|
||||
|
|
|
@ -24,7 +24,10 @@ file(GLOB sources CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp)
|
|||
|
||||
add_executable(${PROJECT_NAME} ${sources})
|
||||
|
||||
# TODO(CK): why is this needed?
|
||||
# enable pedantic compiler warnings
|
||||
include(../cmake/WarningsAsErrors.cmake)
|
||||
|
||||
# TODO(CK): why is this needed on CI?
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME Greeter)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} Greeter::Greeter cxxopts)
|
||||
|
|
|
@ -31,7 +31,7 @@ add_executable(${PROJECT_NAME} ${sources})
|
|||
target_link_libraries(${PROJECT_NAME} doctest::doctest Greeter::Greeter)
|
||||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
|
||||
|
||||
# enable compiler warnings
|
||||
# enable pedantic compiler warnings
|
||||
include(../cmake/WarningsAsErrors.cmake)
|
||||
|
||||
# ---- Add GreeterTests ----
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue