Apply cmake-format

This commit is contained in:
Martchus 2019-06-10 22:43:42 +02:00
parent b48b2f5c06
commit 6c9a956a4f
3 changed files with 23 additions and 10 deletions

View File

@ -284,7 +284,10 @@ function (use_standard_filesystem)
set(CMAKE_REQUIRED_FLAGS -std=c++17)
set(REQUIRED_LIBRARY FAILED)
set(INDEX 0)
foreach (LIBRARY "" "stdc++fs" "c++fs")
foreach (LIBRARY
""
"stdc++fs"
"c++fs")
if (NOT LIBRARY STREQUAL "")
set(CMAKE_REQUIRED_LIBRARIES ${DEFAULT_REQUIRED_LIBRARIES} -l${LIBRARY})
endif ()
@ -298,28 +301,33 @@ function (use_standard_filesystem)
# handle error
if (REQUIRED_LIBRARY STREQUAL "FAILED")
message(FATAL_ERROR "Unable to compile a simple std::filesystem example. A compiler supporting C++17 is required to build this project.")
return ()
message(
FATAL_ERROR
"Unable to compile a simple std::filesystem example. A compiler supporting C++17 is required to build this project."
)
return()
endif ()
# handle case when no library is required
if (REQUIRED_LIBRARY STREQUAL "")
message(STATUS "Linking ${META_PROJECT_NAME} against special library for std::filesystem support is not required.")
return ()
return()
endif ()
# prefer the static version of the library because the ABI might not be stable
# note: stdc++fs seems to be only available as static lib anyways
# prefer the static version of the library because the ABI might not be stable note: stdc++fs seems to be only available
# as static lib anyways
configure_static_library_suffixes()
set(USED_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
find_library(STANDARD_FILE_SYSTEM_LIBRARY "${REQUIRED_LIBRARY}")
configure_dynamic_library_suffixes()
if (NOT STANDARD_FILE_SYSTEM_LIBRARY)
# fallback to using -l if the library is hidden in some sub directory
set (STANDARD_FILE_SYSTEM_LIBRARY "-l${REQUIRED_LIBRARY}")
set(STANDARD_FILE_SYSTEM_LIBRARY "-l${REQUIRED_LIBRARY}")
endif ()
message(STATUS "Linking ${META_PROJECT_NAME} against library \"${STANDARD_FILE_SYSTEM_LIBRARY}\" for std::filesystem support.")
message(
STATUS
"Linking ${META_PROJECT_NAME} against library \"${STANDARD_FILE_SYSTEM_LIBRARY}\" for std::filesystem support.")
set("${ARGS_LIBRARIES_VARIABLE}" "${${ARGS_LIBRARIES_VARIABLE}};${STANDARD_FILE_SYSTEM_LIBRARY}" PARENT_SCOPE)
endfunction ()

View File

@ -337,7 +337,11 @@ if (NOT META_NO_TIDY AND CMAKE_FORMAT_ENABLED AND FORMATABLE_FILES_CMAKE)
message(FATAL_ERROR "Unable to add tidy target; cmake-format not found")
endif ()
if (NOT META_CMAKE_FORMAT_OPTIONS)
set(META_CMAKE_FORMAT_OPTIONS --tab-size=4 --separate-ctrl-name-with-space=True --line-width=125 --autosort=False)
set(META_CMAKE_FORMAT_OPTIONS
--tab-size=4
--separate-ctrl-name-with-space=True
--line-width=125
--autosort=False)
endif ()
add_custom_target("${META_TARGET_NAME}_cmake_tidy"
COMMAND "${CMAKE_FORMAT_BIN}" --in-place ${META_CMAKE_FORMAT_OPTIONS} ${FORMATABLE_FILES_CMAKE}

View File

@ -452,7 +452,8 @@ if (NOT META_NO_INSTALL_TARGETS AND ENABLE_INSTALL_TARGETS)
# add targets to ease creating mingw-w64 packages under Arch Linux
if (MINGW)
option(ENABLE_TARGETS_FOR_MINGW_CROSS_PACKAGING "enable targets to ease creating mingw-w64 packages under Arch Linux" OFF)
option(ENABLE_TARGETS_FOR_MINGW_CROSS_PACKAGING "enable targets to ease creating mingw-w64 packages under Arch Linux"
OFF)
else ()
set(ENABLE_TARGETS_FOR_MINGW_CROSS_PACKAGING OFF)
endif ()