mirror of
https://github.com/CachyOS/New-Cli-Installer.git
synced 2025-01-23 14:32:22 +08:00
Revert cmake reformat
This commit is contained in:
parent
db972aaca7
commit
5f84f11de8
@ -23,25 +23,25 @@ include(FetchContent)
|
||||
FetchContent_Declare(ftxui
|
||||
GIT_REPOSITORY "https://github.com/arthursonzogni/ftxui.git"
|
||||
GIT_TAG "cecd54df42dd66fdf8386ed461e16b725bffc827"
|
||||
)
|
||||
)
|
||||
FetchContent_MakeAvailable(ftxui)
|
||||
|
||||
FetchContent_Declare(fmt
|
||||
GIT_REPOSITORY "https://github.com/fmtlib/fmt.git"
|
||||
GIT_TAG "491ba2dda5a04c2438abb6bd90219de773793ec0"
|
||||
)
|
||||
)
|
||||
FetchContent_MakeAvailable(fmt)
|
||||
|
||||
FetchContent_Declare(nlohmann_json
|
||||
GIT_REPOSITORY "https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent.git"
|
||||
GIT_TAG "v3.10.4"
|
||||
)
|
||||
)
|
||||
FetchContent_MakeAvailable(nlohmann_json)
|
||||
|
||||
FetchContent_Declare(cpr
|
||||
GIT_REPOSITORY "https://github.com/vnepogodin/cpr.git"
|
||||
GIT_TAG "824358455f61629ca43422adce0243bb05e99bf8"
|
||||
)
|
||||
)
|
||||
FetchContent_MakeAvailable(cpr)
|
||||
|
||||
##
|
||||
@ -49,9 +49,9 @@ FetchContent_MakeAvailable(cpr)
|
||||
##
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto")
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fwhole-program")
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
# Link this 'library' to set the c++ standard / compile-time options requested
|
||||
add_library(project_options INTERFACE)
|
||||
@ -77,10 +77,10 @@ include_directories(${CMAKE_SOURCE_DIR}/src)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE project_warnings project_options fmt::fmt ftxui::screen ftxui::dom ftxui::component nlohmann_json::nlohmann_json cpr::cpr)
|
||||
|
||||
option(ENABLE_UNITY "Enable Unity builds of projects" OFF)
|
||||
if (ENABLE_UNITY)
|
||||
if(ENABLE_UNITY)
|
||||
# Add for any project you want to apply unity builds for
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES UNITY_BUILD ON)
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
install(
|
||||
TARGETS ${PROJECT_NAME}
|
||||
|
@ -1,15 +1,15 @@
|
||||
|
||||
option(ENABLE_TIDY "Enable clang-tidy [default: OFF]" OFF)
|
||||
if (ENABLE_TIDY)
|
||||
if(ENABLE_TIDY)
|
||||
find_program(CLANG_TIDY_EXE
|
||||
NAMES clang-tidy-9 clang-tidy-8 clang-tidy-7 clang-tidy
|
||||
DOC "Path to clang-tidy executable")
|
||||
if (NOT CLANG_TIDY_EXE)
|
||||
if(NOT CLANG_TIDY_EXE)
|
||||
message(STATUS "[clang-tidy] Not found.")
|
||||
else ()
|
||||
else()
|
||||
message(STATUS "[clang-tidy] found: ${CLANG_TIDY_EXE}")
|
||||
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXE}")
|
||||
endif ()
|
||||
else ()
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "[clang-tidy] Disabled.")
|
||||
endif ()
|
||||
endif()
|
||||
|
@ -48,10 +48,10 @@ function(set_project_warnings project_name)
|
||||
-Wformat=2
|
||||
)
|
||||
|
||||
if (WARNINGS_AS_ERRORS)
|
||||
if(WARNINGS_AS_ERRORS)
|
||||
set(CLANG_WARNINGS ${CLANG_WARNINGS} -Werror)
|
||||
set(MSVC_WARNINGS ${MSVC_WARNINGS} /WX)
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
set(GCC_WARNINGS
|
||||
${CLANG_WARNINGS}
|
||||
@ -64,13 +64,13 @@ function(set_project_warnings project_name)
|
||||
-Wuseless-cast
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
if(MSVC)
|
||||
set(PROJECT_WARNINGS ${MSVC_WARNINGS})
|
||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
set(PROJECT_WARNINGS ${CLANG_WARNINGS})
|
||||
else ()
|
||||
else()
|
||||
set(PROJECT_WARNINGS ${GCC_WARNINGS})
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
target_compile_options(${project_name} INTERFACE ${PROJECT_WARNINGS})
|
||||
endfunction()
|
||||
|
@ -2,12 +2,12 @@
|
||||
#
|
||||
# The ccache is auto-enabled if the tool is found.
|
||||
# To disable set -DCCACHE=OFF option.
|
||||
if (NOT DEFINED CMAKE_CXX_COMPILER_LAUNCHER)
|
||||
if(NOT DEFINED CMAKE_CXX_COMPILER_LAUNCHER)
|
||||
find_program(CCACHE ccache DOC "ccache tool path; set to OFF to disable")
|
||||
if (CCACHE)
|
||||
if(CCACHE)
|
||||
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE})
|
||||
message(STATUS "[ccache] Enabled: ${CCACHE}")
|
||||
else ()
|
||||
else()
|
||||
message(STATUS "[ccache] Disabled.")
|
||||
endif ()
|
||||
endif ()
|
||||
endif()
|
||||
endif()
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Set a default build type if none was specified
|
||||
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
|
||||
set(CMAKE_BUILD_TYPE
|
||||
RelWithDebInfo
|
||||
@ -12,35 +12,35 @@ if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
"Release"
|
||||
"MinSizeRel"
|
||||
"RelWithDebInfo")
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
# Generate compile_commands.json to make it easier to work with clang based tools
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
option(ENABLE_IPO "Enable Interprocedural Optimization, aka Link Time Optimization (LTO)" OFF)
|
||||
|
||||
if (ENABLE_IPO)
|
||||
if(ENABLE_IPO)
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(
|
||||
RESULT
|
||||
result
|
||||
OUTPUT
|
||||
output)
|
||||
if (result)
|
||||
if(result)
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
|
||||
else ()
|
||||
else()
|
||||
message(SEND_ERROR "IPO is not supported: ${output}")
|
||||
endif ()
|
||||
endif ()
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
|
||||
endif()
|
||||
endif()
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
|
||||
add_compile_options(-fcolor-diagnostics)
|
||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
add_compile_options(-fdiagnostics-color=always)
|
||||
else ()
|
||||
else()
|
||||
message(STATUS "No colored compiler diagnostic set for '${CMAKE_CXX_COMPILER_ID}' compiler.")
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
# Enables STL container checker if not building a release.
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
add_definitions(-D_GLIBCXX_ASSERTIONS)
|
||||
endif ()
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user