Browse Source

Apply cmake-format

sendfile
Martchus 3 years ago
parent
commit
6c9a956a4f
  1. 24
      cmake/modules/3rdParty.cmake
  2. 6
      cmake/modules/BasicConfig.cmake
  3. 3
      cmake/modules/LibraryTarget.cmake

24
cmake/modules/3rdParty.cmake

@ -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 ()

6
cmake/modules/BasicConfig.cmake

@ -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}

3
cmake/modules/LibraryTarget.cmake

@ -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 ()

Loading…
Cancel
Save