{"thread":{"id":"47671","subject":"[RFC PATCH 0/1] Implement CMake build","startedAt":"2018-01-23T00:17:06Z","lastAt":"2018-02-23T19:44:24Z","messageCount":18,"participants":["Isaac Hier","Jacob Keller","Junio C Hamano","Jeff Hostetler","Ævar Arnfjörð Bjarmason","Stephan Beyer","Robert Dailey"],"isPatch":true,"patchVersion":1,"patchTotal":1},"messages":[{"id":"337134","messageId":"20180123001648.24260-1-isaachier@gmail.com","threadId":"47671","inReplyTo":null,"subject":"[RFC PATCH 0/1] Implement CMake build","fromName":"Isaac Hier","fromEmail":"isaachier@gmail.com","sentAt":"2018-01-23T00:16:47Z","receivedAt":"2018-01-23T00:17:06Z","isPatch":true,"sender":{"key":"isaachier@gmail.com","avatar":null},"body":"This patch adds a mostly complete (aside from building tests, documentation,\ninstallation, etc.) CMake build to the git project. I am not sure how much\ninterest there is in a CMake build, so please send me feedback one way or\nanother. Personally, I believe CMake will help with Windows builds and is\nsomewhat easier to read than a Makefile. I considered, adding this to the\ncontrib directory, but CMakeLists.txt almost always reside in the original\ndirectories, and I'm not sure how wise it would be to do otherwise. If you are\ninterested in a CMake build, I would be more than happy to finish up the work\nhere. Decided to wait until I discussed the issue here to finish the final parts\nof the build.\n\nIsaac Hier (1):\n  Implement CMake build\n\n CMakeLists.txt              | 1849 +++++++++++++++++++++++++++++++++++++++++++\n cmake/GenerateCmdlist.cmake |   83 ++\n cmake/fopen_dir_test.c      |   11 +\n cmake/fstat_test.c          |   37 +\n cmake/gmtime_test.c         |    7 +\n cmake/iconv_test.c          |   13 +\n cmake/inline_test.c         |    9 +\n cmake/mkdir_test.c          |    7 +\n cmake/mmap_test.c           |   35 +\n cmake/parens_test.c         |    6 +\n cmake/snprintf_test.c       |    7 +\n cmake/sysctl_test.c         |   11 +\n 12 files changed, 2075 insertions(+)\n create mode 100644 CMakeLists.txt\n create mode 100644 cmake/GenerateCmdlist.cmake\n create mode 100644 cmake/fopen_dir_test.c\n create mode 100644 cmake/fstat_test.c\n create mode 100644 cmake/gmtime_test.c\n create mode 100644 cmake/iconv_test.c\n create mode 100644 cmake/inline_test.c\n create mode 100644 cmake/mkdir_test.c\n create mode 100644 cmake/mmap_test.c\n create mode 100644 cmake/parens_test.c\n create mode 100644 cmake/snprintf_test.c\n create mode 100644 cmake/sysctl_test.c\n\n-- \n2.14.1\n\n"},{"id":"337135","messageId":"20180123001648.24260-2-isaachier@gmail.com","threadId":"47671","inReplyTo":"20180123001648.24260-1-isaachier@gmail.com","subject":"[RFC PATCH 1/1] Implement CMake build","fromName":"Isaac Hier","fromEmail":"isaachier@gmail.com","sentAt":"2018-01-23T00:16:48Z","receivedAt":"2018-01-23T00:17:15Z","isPatch":true,"sender":{"key":"isaachier@gmail.com","avatar":null},"body":"Signed-off-by: Isaac Hier <isaachier@gmail.com>\n---\n CMakeLists.txt              | 1849 +++++++++++++++++++++++++++++++++++++++++++\n cmake/GenerateCmdlist.cmake |   83 ++\n cmake/fopen_dir_test.c      |   11 +\n cmake/fstat_test.c          |   37 +\n cmake/gmtime_test.c         |    7 +\n cmake/iconv_test.c          |   13 +\n cmake/inline_test.c         |    9 +\n cmake/mkdir_test.c          |    7 +\n cmake/mmap_test.c           |   35 +\n cmake/parens_test.c         |    6 +\n cmake/snprintf_test.c       |    7 +\n cmake/sysctl_test.c         |   11 +\n 12 files changed, 2075 insertions(+)\n create mode 100644 CMakeLists.txt\n create mode 100644 cmake/GenerateCmdlist.cmake\n create mode 100644 cmake/fopen_dir_test.c\n create mode 100644 cmake/fstat_test.c\n create mode 100644 cmake/gmtime_test.c\n create mode 100644 cmake/iconv_test.c\n create mode 100644 cmake/inline_test.c\n create mode 100644 cmake/mkdir_test.c\n create mode 100644 cmake/mmap_test.c\n create mode 100644 cmake/parens_test.c\n create mode 100644 cmake/snprintf_test.c\n create mode 100644 cmake/sysctl_test.c\n\ndiff --git a/CMakeLists.txt b/CMakeLists.txt\nnew file mode 100644\nindex 000000000..dff3a44c8\n--- /dev/null\n+++ b/CMakeLists.txt\n@@ -0,0 +1,1849 @@\n+cmake_minimum_required(VERSION 3.3)\n+\n+set(CMAKE_C_STANDARD 99)\n+set(CMAKE_C_STANDARD_REQUIRED ON)\n+\n+set(bin_dir \"bin\")\n+set(lib_dir \"lib\")\n+set(git_exec_dir \"libexec/git-core\")\n+set(mergetools_dir \"${git_exec_dir}/mergetools\")\n+set(share_dir \"share\")\n+set(man_dir \"${share_dir}/man\")\n+set(info_dir \"${share_dir}/info\")\n+set(gitweb_dir \"${share_dir}/gitweb\")\n+set(locale_dir \"${share_dir}/locale\")\n+set(template_dir \"${share_dir}/git-core/templates\")\n+set(html_dir \"${share_dir}/doc/git-doc\")\n+set(etc_gitconfig \"etc/gitconfig\")\n+set(etc_gitattributes \"etc/gitattributes\")\n+\n+find_package(Git)\n+if(IS_DIRECTORY \"${CMAKE_CURRENT_SOURCE_DIR}/.git\" AND GIT_FOUND)\n+  execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse -q --verify HEAD\n+                  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}\n+                  OUTPUT_VARIABLE GIT_BUILT_FROM_COMMIT\n+                  OUTPUT_STRIP_TRAILING_WHITESPACE)\n+  message(STATUS \"GIT_BUILT_FROM_COMMIT: ${GIT_BUILT_FROM_COMMIT}\")\n+endif()\n+\n+if(EXISTS \"${CMAKE_CURRENT_SOURCE_DIR}/version\" AND\n+   NOT IS_DIRECTORY \"${CMAKE_CURRENT_SOURCE_DIR}/version\")\n+  file(READ \"${CMAKE_CURRENT_SOURCE_DIR}/version\" GIT_VERSION)\n+elseif(IS_DIRECTORY \"${CMAKE_CURRENT_SOURCE_DIR}/.git\" AND GIT_FOUND)\n+  execute_process(COMMAND ${GIT_EXECUTABLE} describe --match \"v[0-9]*\" HEAD\n+                  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}\n+                  OUTPUT_VARIABLE GIT_VERSION\n+                  OUTPUT_STRIP_TRAILING_WHITESPACE)\n+  if(GIT_VERSION MATCHES \"v[0-9]*\")\n+    string(REPLACE \"-\" \".\" GIT_VERSION \"${GIT_VERSION}\")\n+    execute_process(COMMAND ${GIT_EXECUTABLE} diff-index --name-only HEAD --\n+                    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}\n+                    OUTPUT_VARIABLE git_diff_index_output\n+                    OUTPUT_STRIP_TRAILING_WHITESPACE)\n+    if(git_diff_index_output)\n+      set(GIT_VERSION \"${GIT_VERSION}.dirty\")\n+    endif()\n+    message(STATUS \"GIT_VERSION: ${GIT_VERSION}\")\n+  else()\n+    message(FATAL_ERROR \"Cannot determine project version\")\n+  endif()\n+else()\n+  set(GIT_VERSION \"${DEFAULT_VERSION}\")\n+endif()\n+\n+string(REGEX REPLACE \"^v([0-9]+\\\\.[0-9]+\\\\.[0-9]+).*$\" \"\\\\1\"\n+       simplified_version \"${GIT_VERSION}\")\n+project(git VERSION \"${simplified_version}\" LANGUAGES C)\n+message(STATUS \"PROJECT_VERSION: ${PROJECT_VERSION}\")\n+\n+set(GIT_USER_AGENT \"git/${PROJECT_VERSION}\" CACHE STRING\n+    \"User-agent used for network interactions\")\n+message(STATUS \"GIT_USER_AGENT: ${GIT_USER_AGENT}\")\n+\n+list(APPEND CMAKE_MODULE_PATH \"${CMAKE_CURRENT_SOURCE_DIR}/cmake\")\n+\n+include(CheckCCompilerFlag)\n+include(CheckIncludeFile)\n+include(CheckFunctionExists)\n+include(CheckLibraryExists)\n+include(CheckPrototypeDefinition)\n+include(CheckStructHasMember)\n+include(CheckSymbolExists)\n+include(CheckTypeSize)\n+include(CMakeDependentOption)\n+include(CTest)\n+\n+include(GenerateCmdlist)\n+\n+generate_cmdlist()\n+\n+macro(print_bool arg_name)\n+  if(${arg_name})\n+    message(STATUS \"${arg_name}: true\")\n+  else()\n+    message(STATUS \"${arg_name}: false\")\n+  endif()\n+endmacro()\n+\n+macro(add_c_flag c_flags flag)\n+  string(MAKE_C_IDENTIFIER \"${flag}\" flag_var)\n+  check_c_compiler_flag(\"${flag}\" have_${flag_var})\n+  if(have_${flag_var})\n+    set(${c_flags} \"${${c_flags}} ${flag}\")\n+  endif()\n+endmacro()\n+\n+# Sources defined here to append to during configuration stage.\n+\n+set(program_src\n+    \"credential-store.c\"\n+    \"daemon.c\"\n+    \"fast-import.c\"\n+    \"http-backend.c\"\n+    \"sh-i18n--envsubst.c\"\n+    \"shell.c\"\n+    \"show-index.c\"\n+    \"upload-pack.c\")\n+\n+if(ENABLE_TESTING)\n+  set(test_program_src\n+    \"t/helper/test-chmtime.c\"\n+    \"t/helper/test-ctype.c\"\n+    \"t/helper/test-config.c\"\n+    \"t/helper/test-date.c\"\n+    \"t/helper/test-delta.c\"\n+    \"t/helper/test-drop-caches.c\"\n+    \"t/helper/test-dump-cache-tree.c\"\n+    \"t/helper/test-dump-fsmonitor.c\"\n+    \"t/helper/test-dump-split-index.c\"\n+    \"t/helper/test-dump-untracked-cache.c\"\n+    \"t/helper/test-example-decorate.c\"\n+    \"t/helper/test-fake-ssh.c\"\n+    \"t/helper/test-genrandom.c\"\n+    \"t/helper/test-hashmap.c\"\n+    \"t/helper/test-index-version.c\"\n+    \"t/helper/test-lazy-init-name-hash.c\"\n+    \"t/helper/test-line-buffer.c\"\n+    \"t/helper/test-match-trees.c\"\n+    \"t/helper/test-mergesort.c\"\n+    \"t/helper/test-mktemp.c\"\n+    \"t/helper/test-online-cpus.c\"\n+    \"t/helper/test-parse-options.c\"\n+    \"t/helper/test-path-utils.c\"\n+    \"t/helper/test-prio-queue.c\"\n+    \"t/helper/test-read-cache.c\"\n+    \"t/helper/test-write-cache.c\"\n+    \"t/helper/test-ref-store.c\"\n+    \"t/helper/test-regex.c\"\n+    \"t/helper/test-revision-walking.c\"\n+    \"t/helper/test-run-command.c\"\n+    \"t/helper/test-scrap-cache-tree.c\"\n+    \"t/helper/test-sha1.c\"\n+    \"t/helper/test-sha1-array.c\"\n+    \"t/helper/test-sigchain.c\"\n+    \"t/helper/test-strcmp-offset.c\"\n+    \"t/helper/test-string-list.c\"\n+    \"t/helper/test-submodule-config.c\"\n+    \"t/helper/test-subprocess.c\"\n+    \"t/helper/test-svn-fe.c\"\n+    \"t/helper/test-urlmatch-normalization.c\"\n+    \"t/helper/test-wildmatch.c\")\n+endif()\n+\n+set(lib_src\n+    \"abspath.c\"\n+    \"advice.c\"\n+    \"alias.c\"\n+    \"alloc.c\"\n+    \"apply.c\"\n+    \"archive.c\"\n+    \"archive-tar.c\"\n+    \"archive-zip.c\"\n+    \"argv-array.c\"\n+    \"attr.c\"\n+    \"base85.c\"\n+    \"bisect.c\"\n+    \"blame.c\"\n+    \"blob.c\"\n+    \"branch.c\"\n+    \"bulk-checkin.c\"\n+    \"bundle.c\"\n+    \"cache-tree.c\"\n+    \"checkout.c\"\n+    \"color.c\"\n+    \"column.c\"\n+    \"combine-diff.c\"\n+    \"commit.c\"\n+    \"compat/obstack.c\"\n+    \"compat/terminal.c\"\n+    \"config.c\"\n+    \"connect.c\"\n+    \"connected.c\"\n+    \"convert.c\"\n+    \"copy.c\"\n+    \"credential.c\"\n+    \"csum-file.c\"\n+    \"ctype.c\"\n+    \"date.c\"\n+    \"decorate.c\"\n+    \"diffcore-break.c\"\n+    \"diffcore-delta.c\"\n+    \"diffcore-order.c\"\n+    \"diffcore-pickaxe.c\"\n+    \"diffcore-rename.c\"\n+    \"diff-delta.c\"\n+    \"diff-lib.c\"\n+    \"diff-no-index.c\"\n+    \"diff.c\"\n+    \"dir.c\"\n+    \"dir-iterator.c\"\n+    \"editor.c\"\n+    \"entry.c\"\n+    \"environment.c\"\n+    \"ewah/bitmap.c\"\n+    \"ewah/ewah_bitmap.c\"\n+    \"ewah/ewah_io.c\"\n+    \"ewah/ewah_rlw.c\"\n+    \"exec_cmd.c\"\n+    \"fetch-pack.c\"\n+    \"fsck.c\"\n+    \"fsmonitor.c\"\n+    \"gettext.c\"\n+    \"gpg-interface.c\"\n+    \"graph.c\"\n+    \"grep.c\"\n+    \"hashmap.c\"\n+    \"help.c\"\n+    \"hex.c\"\n+    \"ident.c\"\n+    \"kwset.c\"\n+    \"levenshtein.c\"\n+    \"line-log.c\"\n+    \"line-range.c\"\n+    \"list-objects.c\"\n+    \"list-objects-filter.c\"\n+    \"list-objects-filter-options.c\"\n+    \"ll-merge.c\"\n+    \"lockfile.c\"\n+    \"log-tree.c\"\n+    \"mailinfo.c\"\n+    \"mailmap.c\"\n+    \"match-trees.c\"\n+    \"merge.c\"\n+    \"merge-blobs.c\"\n+    \"merge-recursive.c\"\n+    \"mergesort.c\"\n+    \"mru.c\"\n+    \"name-hash.c\"\n+    \"notes.c\"\n+    \"notes-cache.c\"\n+    \"notes-merge.c\"\n+    \"notes-utils.c\"\n+    \"object.c\"\n+    \"oidmap.c\"\n+    \"oidset.c\"\n+    \"packfile.c\"\n+    \"pack-bitmap.c\"\n+    \"pack-bitmap-write.c\"\n+    \"pack-check.c\"\n+    \"pack-objects.c\"\n+    \"pack-revindex.c\"\n+    \"pack-write.c\"\n+    \"pager.c\"\n+    \"parse-options.c\"\n+    \"parse-options-cb.c\"\n+    \"patch-delta.c\"\n+    \"patch-ids.c\"\n+    \"path.c\"\n+    \"pathspec.c\"\n+    \"pkt-line.c\"\n+    \"preload-index.c\"\n+    \"pretty.c\"\n+    \"prio-queue.c\"\n+    \"progress.c\"\n+    \"prompt.c\"\n+    \"protocol.c\"\n+    \"quote.c\"\n+    \"reachable.c\"\n+    \"read-cache.c\"\n+    \"reflog-walk.c\"\n+    \"refs.c\"\n+    \"refs/files-backend.c\"\n+    \"refs/iterator.c\"\n+    \"refs/packed-backend.c\"\n+    \"refs/ref-cache.c\"\n+    \"ref-filter.c\"\n+    \"remote.c\"\n+    \"replace_object.c\"\n+    \"repository.c\"\n+    \"rerere.c\"\n+    \"resolve-undo.c\"\n+    \"revision.c\"\n+    \"run-command.c\"\n+    \"send-pack.c\"\n+    \"sequencer.c\"\n+    \"server-info.c\"\n+    \"setup.c\"\n+    \"sha1-array.c\"\n+    \"sha1-lookup.c\"\n+    \"sha1_file.c\"\n+    \"sha1_name.c\"\n+    \"shallow.c\"\n+    \"sideband.c\"\n+    \"sigchain.c\"\n+    \"split-index.c\"\n+    \"strbuf.c\"\n+    \"streaming.c\"\n+    \"string-list.c\"\n+    \"submodule.c\"\n+    \"submodule-config.c\"\n+    \"sub-process.c\"\n+    \"symlinks.c\"\n+    \"tag.c\"\n+    \"tempfile.c\"\n+    \"tmp-objdir.c\"\n+    \"trace.c\"\n+    \"trailer.c\"\n+    \"transport.c\"\n+    \"transport-helper.c\"\n+    \"tree-diff.c\"\n+    \"tree.c\"\n+    \"tree-walk.c\"\n+    \"unpack-trees.c\"\n+    \"url.c\"\n+    \"urlmatch.c\"\n+    \"usage.c\"\n+    \"userdiff.c\"\n+    \"utf8.c\"\n+    \"varint.c\"\n+    \"version.c\"\n+    \"versioncmp.c\"\n+    \"walker.c\"\n+    \"wildmatch.c\"\n+    \"worktree.c\"\n+    \"wrapper.c\"\n+    \"write_or_die.c\"\n+    \"ws.c\"\n+    \"wt-status.c\"\n+    \"xdiff-interface.c\"\n+    \"zlib\")\n+\n+set(builtin_src\n+    \"builtin/add.c\"\n+    \"builtin/am.c\"\n+    \"builtin/annotate.c\"\n+    \"builtin/apply.c\"\n+    \"builtin/archive.c\"\n+    \"builtin/bisect--helper.c\"\n+    \"builtin/blame.c\"\n+    \"builtin/branch.c\"\n+    \"builtin/bundle.c\"\n+    \"builtin/cat-file.c\"\n+    \"builtin/check-attr.c\"\n+    \"builtin/check-ignore.c\"\n+    \"builtin/check-mailmap.c\"\n+    \"builtin/check-ref-format.c\"\n+    \"builtin/checkout-index.c\"\n+    \"builtin/checkout.c\"\n+    \"builtin/clean.c\"\n+    \"builtin/clone.c\"\n+    \"builtin/column.c\"\n+    \"builtin/commit-tree.c\"\n+    \"builtin/commit.c\"\n+    \"builtin/config.c\"\n+    \"builtin/count-objects.c\"\n+    \"builtin/credential.c\"\n+    \"builtin/describe.c\"\n+    \"builtin/diff-files.c\"\n+    \"builtin/diff-index.c\"\n+    \"builtin/diff-tree.c\"\n+    \"builtin/diff.c\"\n+    \"builtin/difftool.c\"\n+    \"builtin/fast-export.c\"\n+    \"builtin/fetch-pack.c\"\n+    \"builtin/fetch.c\"\n+    \"builtin/fmt-merge-msg.c\"\n+    \"builtin/for-each-ref.c\"\n+    \"builtin/fsck.c\"\n+    \"builtin/gc.c\"\n+    \"builtin/get-tar-commit-id.c\"\n+    \"builtin/grep.c\"\n+    \"builtin/hash-object.c\"\n+    \"builtin/help.c\"\n+    \"builtin/index-pack.c\"\n+    \"builtin/init-db.c\"\n+    \"builtin/interpret-trailers.c\"\n+    \"builtin/log.c\"\n+    \"builtin/ls-files.c\"\n+    \"builtin/ls-remote.c\"\n+    \"builtin/ls-tree.c\"\n+    \"builtin/mailinfo.c\"\n+    \"builtin/mailsplit.c\"\n+    \"builtin/merge.c\"\n+    \"builtin/merge-base.c\"\n+    \"builtin/merge-file.c\"\n+    \"builtin/merge-index.c\"\n+    \"builtin/merge-ours.c\"\n+    \"builtin/merge-recursive.c\"\n+    \"builtin/merge-tree.c\"\n+    \"builtin/mktag.c\"\n+    \"builtin/mktree.c\"\n+    \"builtin/mv.c\"\n+    \"builtin/name-rev.c\"\n+    \"builtin/notes.c\"\n+    \"builtin/pack-objects.c\"\n+    \"builtin/pack-redundant.c\"\n+    \"builtin/pack-refs.c\"\n+    \"builtin/patch-id.c\"\n+    \"builtin/prune-packed.c\"\n+    \"builtin/prune.c\"\n+    \"builtin/pull.c\"\n+    \"builtin/push.c\"\n+    \"builtin/read-tree.c\"\n+    \"builtin/rebase--helper.c\"\n+    \"builtin/receive-pack.c\"\n+    \"builtin/reflog.c\"\n+    \"builtin/remote.c\"\n+    \"builtin/remote-ext.c\"\n+    \"builtin/remote-fd.c\"\n+    \"builtin/repack.c\"\n+    \"builtin/replace.c\"\n+    \"builtin/rerere.c\"\n+    \"builtin/reset.c\"\n+    \"builtin/rev-list.c\"\n+    \"builtin/rev-parse.c\"\n+    \"builtin/revert.c\"\n+    \"builtin/rm.c\"\n+    \"builtin/send-pack.c\"\n+    \"builtin/shortlog.c\"\n+    \"builtin/show-branch.c\"\n+    \"builtin/show-ref.c\"\n+    \"builtin/stripspace.c\"\n+    \"builtin/submodule--helper.c\"\n+    \"builtin/symbolic-ref.c\"\n+    \"builtin/tag.c\"\n+    \"builtin/unpack-file.c\"\n+    \"builtin/unpack-objects.c\"\n+    \"builtin/update-index.c\"\n+    \"builtin/update-ref.c\"\n+    \"builtin/update-server-info.c\"\n+    \"builtin/upload-archive.c\"\n+    \"builtin/var.c\"\n+    \"builtin/verify-commit.c\"\n+    \"builtin/verify-pack.c\"\n+    \"builtin/verify-tag.c\"\n+    \"builtin/worktree.c\"\n+    \"builtin/write-tree.c\")\n+\n+add_c_flag(CMAKE_C_FLAGS \"-Wall\")\n+\n+option(DEVELOPER \"Enable developer warnings\" OFF)\n+if(DEVELOPER)\n+  set(dev_c_flags\n+      \"-Werror\"\n+      \"-Wdeclaration-after-statement\"\n+      \"-Wno-format-zero-length\"\n+      \"-Wold-style-definition\"\n+      \"-Woverflow\"\n+      \"-Wpointer-arith\"\n+      \"-Wstrict-prototypes\"\n+      \"-Wunused\"\n+      \"-Wvla\")\n+  foreach(flag ${dev_c_flags})\n+    add_c_flag(CMAKE_C_FLAGS \"${flag}\")\n+  endforeach()\n+endif()\n+\n+set(CMAKE_INCLUDE_CURRENT_DIR ON)\n+\n+set(SANITIZE \"\" CACHE STRING \"Comma-delimited list of sanitizer flags\")\n+if(SANITIZE)\n+  add_c_flag(CMAKE_C_FLAGS \"-fsanitize=${SANITIZE}\")\n+  add_c_flag(CMAKE_C_FLAGS \"-fno-sanitize-recover=${SANITIZE}\")\n+  add_c_flag(CMAKE_C_FLAGS \"-fno-omit-frame-pointer\")\n+  string(REPLACE \",\" \";\" SANITIZERS \"${SANITIZE}\")\n+  if(\"undefined\" IN_LIST SANITIZERS)\n+    list(APPEND basic_defs \"-DNO_UNALIGNED_LOADS\")\n+  endif()\n+  if(\"leak\" IN_LIST SANITIZERS)\n+    list(APPEND basic_defs \"-DSUPPRESS_ANNOTATED_LEAKS\")\n+  endif()\n+endif()\n+\n+message(STATUS \"CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}\")\n+\n+list(APPEND basic_defs \"-DGIT_HOST_CPU=\\\"${CMAKE_SYSTEM_PROCESSOR}\\\"\")\n+message(STATUS \"GIT_HOST_CPU: ${CMAKE_SYSTEM_PROCESSOR}\")\n+\n+if(WIN32)\n+  set(socket_headers \"winsock2.h;ws2tcpip.h\")\n+else()\n+  set(socket_headers \"sys/types.h;sys/socket.h\")\n+endif()\n+\n+set(CMAKE_EXTRA_INCLUDE_FILES ${socket_headers})\n+check_type_size(socklen_t sizeof_socklen_t)\n+if(sizeof_socklen_t)\n+  set(SOCKLEN_T \"socklen_t\")\n+else()\n+  set(SOCKLEN_T \"size_t\")\n+endif()\n+set(CMAKE_EXTRA_INCLUDE_FILES)\n+message(STATUS \"socklen_t type: ${SOCKLEN_T}\")\n+if(SOCKLEN_T)\n+  list(APPEND basic_defs \"-Dsocklen_t=${SOCKLEN_T}\")\n+endif()\n+\n+set(INLINE \"\")\n+foreach(inline_keyword \"inline\" \"__inline\" \"__inline__\")\n+  try_compile(inline_compile_result\n+    \"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp\"\n+    SOURCES \"${CMAKE_CURRENT_SOURCE_DIR}/cmake/inline_test.c\"\n+    COMPILE_DEFINITIONS \"-DINLINE=${inline_keyword}\")\n+  if(inline_compile_result)\n+    set(INLINE \"${inline_keyword}\")\n+    break()\n+  endif()\n+endforeach()\n+message(STATUS \"INLINE: ${INLINE}\")\n+if(INLINE)\n+  list(APPEND basic_defs \"-DINLINE=${INLINE}\")\n+endif()\n+\n+if(NOT CMAKE_CROSSCOMPILING)\n+  string(REPLACE \"-Wall\" \"\" flags_warning_disabled \"${CMAKE_C_FLAGS}\")\n+  string(REPLACE \"-Werror\" \"\" flags_warning_disabled\n+         \"${flags_warning_disabled}\")\n+  try_run(snprintf_run_result\n+          snprintf_compile_result\n+          \"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp\"\n+          \"${CMAKE_CURRENT_SOURCE_DIR}/cmake/snprintf_test.c\"\n+          CMAKE_FLAGS \"-DCMAKE_C_FLAGS=${flags_warnings_disabled}\"\n+          COMPILE_OUTPUT_VARIABLE snprintf_compile_output)\n+  if(snprintf_compile_result)\n+    if(snprintf_run_result EQUAL -1)\n+      set(SNPRINTF_RETURNS_BOGUS ON)\n+    elseif(NOT snprintf_run_result EQUAL 2)\n+      message(WARNING\n+        \"Invalid return value for snprintf_test: ${snprintf_run_result}\")\n+      set(SNPRINTF_RETURNS_BOGUS ON)\n+    endif()\n+  else()\n+    message(WARNING \"Cannot compile snprintf_test: ${snprintf_compile_output}\")\n+    set(SNPRINTF_RETURNS_BOGUS ON)\n+  endif()\n+endif()\n+print_bool(SNPRINTF_RETURNS_BOGUS)\n+if(SNPRINTF_RETURNS_BOGUS)\n+  list(APPEND compat_defs \"-DSNPRINTF_RETURNS_BOGUS\")\n+  list(APPEND compat_src \"compat/snprintf.c\")\n+endif()\n+\n+if(NOT CMAKE_CROSSCOMPILING)\n+  try_run(fopen_dir_run_result\n+          fopen_dir_compile_result\n+          \"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp\"\n+          \"${CMAKE_CURRENT_SOURCE_DIR}/cmake/fopen_dir_test.c\"\n+          COMPILE_OUTPUT_VARIABLE fopen_dir_compile_output\n+          ARGS \"${CMAKE_CURRENT_SOURCE_DIR}\")\n+  if(fopen_dir_compile_result)\n+    if(fopen_dir_run_result EQUAL 0)\n+      set(FREAD_READS_DIRECTORIES ON)\n+    endif()\n+  else()\n+    message(WARNING \"Cannot compile fopen_dir_test: \"\n+            \"${fopen_dir_compile_output}\")\n+  endif()\n+endif()\n+print_bool(FREAD_READS_DIRECTORIES)\n+if(FREAD_READS_DIRECTORIES)\n+  list(APPEND compat_defs \"-DFREAD_READS_DIRECTORIES\")\n+  list(APPEND compat_src \"compat/fopen.c\")\n+endif()\n+\n+find_package(OpenSSL)\n+cmake_dependent_option(\n+  OPENSSL \"Use OpenSSL\" ON \"OPENSSL_FOUND;not_apple_common_crypto\" OFF)\n+if(NOT OPENSSL)\n+  list(APPEND basic_defs \"-DNO_OPENSSL\")\n+endif()\n+\n+set(PCRE_VERSION \"\" CACHE STRING \"pcre version (1 or 2), leave blank to omit\")\n+set_property(CACHE PCRE_VERSION PROPERTY STRINGS \"1;2\")\n+if(PCRE_VERSION AND NOT PCRE_VERSION MATCHES \"^(1|2)$\")\n+  message(FATAL_ERROR \"Invalid pcre version, must be blank, 1, or 2\")\n+endif()\n+\n+if(PCRE_VERSION)\n+  if(NOT DEFINED PCRE_LIBRARY OR NOT DEFINED PCRE_INCLUDE_DIR)\n+    if(PCRE_VERSION STREQUAL \"2\")\n+      find_path(PCRE_INCLUDE_DIR \"pcre2.h\")\n+      find_library(PCRE_LIBRARY NAMES pcre2)\n+    else()\n+      set(PCRE_VERSION \"1\")\n+      find_path(PCRE_INCLUDE_DIR \"pcre.h\")\n+      find_library(PCRE_LIBRARY NAMES pcre)\n+    endif()\n+    mark_as_advanced(PCRE_LIBRARY PCRE_INCLUDE_DIR)\n+\n+    message(STATUS \"PCRE_VERSION: ${PCRE_VERSION}\")\n+    message(STATUS \"PCRE_INCLUDE_DIR: ${PCRE_INCLUDE_DIR}\")\n+    message(STATUS \"PCRE_LIBRARY: ${PCRE_LIBRARY}\")\n+  endif()\n+\n+  if(PCRE_INCLUDE_DIR AND PCRE_LIBRARY)\n+    list(APPEND basic_defs \"-DUSE_LIBPCRE${PCRE_VERSION}\")\n+    list(APPEND include_dirs ${PCRE_INCLUDE_DIR})\n+    list(APPEND libs ${PCRE_LIBRARY})\n+\n+    if(PCRE_VERSION STREQUAL \"1\" AND PCRE_LIBRARY)\n+      check_symbol_exists(PCRE_JIT_CONFIG \"pcre.h\" has_jit)\n+      set(CMAKE_REQUIRED_INCLUDES)\n+      if(has_jit)\n+        set(LIBPCRE1_JIT ON)\n+      endif()\n+      print_bool(LIBPCRE1_JIT)\n+      if(NOT LIBPCRE1_JIT)\n+        list(APPEND basic_defs \"-DNO_LIBPCRE1_JIT\")\n+      endif()\n+    endif()\n+  endif()\n+endif()\n+\n+check_include_file(\"alloca.h\" HAVE_ALLOCA_H)\n+print_bool(HAVE_ALLOCA_H)\n+if(HAVE_ALLOCA_H)\n+  list(APPEND basic_defs \"-DHAVE_ALLOCA_H\")\n+endif()\n+\n+find_package(CURL)\n+cmake_dependent_option(CURL \"Use libcurl, needed for HTTP transport\" ON\n+                       \"CURL_FOUND\" OFF)\n+if(CURL)\n+  set(NO_CURL \"0\")\n+else()\n+  set(NO_CURL \"1\")\n+  list(APPEND basic_defs \"-DNO_CURL\")\n+endif()\n+\n+find_package(EXPAT)\n+cmake_dependent_option(EXPAT \"Enable expat for HTTP parsing\" ON\n+                      \"EXPAT_FOUND\" OFF)\n+# EXPAT_NEEDS_XMLPARSE_H not handled in CMake build, seeing as CMake FindEXPAT\n+# explicitly relies on the existence of \"expat.h\" to find includes directory.\n+\n+if(CURL AND CURL_VERSION_STRING VERSION_GREATER_EQUAL \"7.22.0\")\n+  list(APPEND basic_defs \"-DUSE_CURL_FOR_IMAP_SEND\")\n+  set(imap_send_builddeps \"http.c\")\n+  set(imap_send_libs ${CURL_LIBRARIES})\n+endif()\n+\n+find_package(Gettext)\n+find_package(Intl)\n+cmake_dependent_option(GETTEXT \"Translate git output\" ON\n+                       \"GETTEXT_FOUND;Intl_FOUND\" OFF)\n+\n+find_library(iconv_lib_path NAMES iconv libiconv libiconv-2)\n+if(iconv_lib_path)\n+  set(iconv_lib ${iconv_lib_path})\n+endif()\n+\n+if(NOT GETTEXT)\n+  list(APPEND basic_defs \"-DNO_GETTEXT\")\n+  set(no_gettext ON)\n+endif()\n+cmake_dependent_option(USE_GETTEXT_SCHEME_FALLTHROUGH \"${doc_string}\" OFF\n+                       \"no_gettext\" ON)\n+if(GETTEXT)\n+  set(doc_string \"Enable if you do not trust installed gettext translation\")\n+  set(doc_string \"${doc_string} of the shell scripts output\")\n+\n+  check_include_file(\"libcharset.h\" HAVE_LIBCHARSET_H)\n+  if(HAVE_LIBCHARSET_H)\n+    list(APPEND basic_defs \"-DHAVE_LIBCHARSET_H\")\n+    check_library_exists(charset locale_charset \"\" have_libcharset)\n+    if(have_libcharset)\n+      set(CHARSET_LIB charset)\n+    elseif(iconv_lib)\n+      check_library_exists(${iconv_lib} locale_charset \"\" have_locale_charset_libiconv)\n+      if(have_locale_charset_libiconv)\n+        set(CHARSET_LIB ${iconv_lib})\n+      else()\n+        message(FATAL_ERROR \"Cannot find library that defines locale_charset\")\n+      endif()\n+    endif()\n+    list(APPEND libs ${CHARSET_LIB})\n+  endif()\n+\n+  check_function_exists(nl_langinfo LIBC_CONTAINS_LIBINTL)\n+  print_bool(LIBC_CONTAINS_LIBINTL)\n+  if(NOT LIBC_CONTAINS_LIBINTL)\n+    list(APPEND libs ${Intl_LIBRARY})\n+    set(CMAKE_REQUIRED_LIBRARIES \"${Intl_LIBRARY}\")\n+    check_function_exists(nl_langinfo nl_langinfo_found)\n+    if(NOT nl_langinfo_found)\n+      message(FATAL_ERROR \"nl_langinfo cannot be found in ${Intl_LIBRARY}\")\n+    endif()\n+    set(CMAKE_REQUIRED_LIBRARIES)\n+  endif()\n+\n+  # TODO: MSGFMT_EXTENDED_OPTIONS?\n+endif()\n+\n+check_include_file(\"paths.h\" HAVE_PATHS_H)\n+print_bool(HAVE_PATHS_H)\n+if(HAVE_PATHS_H)\n+  list(APPEND basic_defs \"-DHAVE_PATHS_H\")\n+endif()\n+\n+check_include_file(\"inttypes.h\" HAVE_INTTYPES_H)\n+print_bool(HAVE_INTTYPES_H)\n+if(NOT HAVE_INTTYPES_H)\n+  list(APPEND basic_defs \"-DNO_INTTYPES_H\")\n+endif()\n+\n+check_symbol_exists(DT_UNKNOWN \"dirent.h\" have_dt_unknown)\n+if(have_dt_unknown)\n+  check_struct_has_member(\"struct dirent\" d_type \"dirent.h\" have_d_type)\n+  if(have_d_type)\n+    set(D_TYPE_IN_DIRENT ON)\n+  endif()\n+  print_bool(D_TYPE_IN_DIRENT)\n+else()\n+  set(D_TYPE_IN_DIRENT ON)\n+endif()\n+\n+if(NOT D_TYPE_IN_DIRENT)\n+  list(APPEND basic_defs \"-DNO_D_TYPE_IN_DIRENT\")\n+endif()\n+\n+check_include_file(\"strings.h\" HAVE_STRINGS_H)\n+print_bool(HAVE_STRINGS_H)\n+if(HAVE_STRINGS_H)\n+  list(APPEND basic_defs \"-DHAVE_STRINGS_H\")\n+endif()\n+\n+check_function_exists(strcasestr STRCASESTR)\n+print_bool(STRCASESTR)\n+if(NOT STRCASESTR)\n+  list(APPEND compat_defs \"-DNO_STRCASESTR\")\n+  list(APPEND compat_src \"compat/strcasestr.c\")\n+endif()\n+\n+check_function_exists(hstrerror HSTRERROR)\n+print_bool(HSTRERROR)\n+if(NOT HSTRERROR)\n+  list(APPEND compat_defs \"-DNO_HSTRERROR\")\n+  list(APPEND compat_src \"compat/hstrerror.c\")\n+endif()\n+\n+check_function_exists(memmem MEMMEM)\n+print_bool(MEMMEM)\n+if(NOT MEMMEM)\n+  list(APPEND compat_defs \"-DNO_MEMMEM\")\n+  list(APPEND compat_src \"compat/memmem.c\")\n+endif()\n+\n+check_function_exists(getpagesize GETPAGESIZE)\n+print_bool(GETPAGESIZE)\n+if(NOT GETPAGESIZE)\n+  list(APPEND compat_defs \"-DNO_GETPAGESIZE\")\n+endif()\n+\n+check_function_exists(strlcpy STRLCPY)\n+print_bool(STRLCPY)\n+if(NOT STRLCPY)\n+  list(APPEND compat_defs \"-DNO_STRLCPY\")\n+  list(APPEND compat_src \"compat/strlcpy.c\")\n+endif()\n+\n+check_function_exists(strtoimax have_strtoimax)\n+if(NOT have_strtoimax)\n+  check_function_exists(strtoumax have_strtoumax)\n+endif()\n+if(have_strtoimax OR have_strtoumax)\n+  set(STRTOUMAX ON)\n+endif()\n+print_bool(STRTOUMAX)\n+if(NOT STRTOUMAX)\n+  list(APPEND compat_defs \"-DNO_STRTOUMAX\")\n+  list(APPEND compat_src\n+       \"compat/strtoumax.c\"\n+       \"compat/strtoimax.c\")\n+endif()\n+\n+check_function_exists(strtoull STRTOULL)\n+print_bool(STRTOULL)\n+if(NOT STRTOULL)\n+  list(APPEND compat_defs \"-DNO_STRTOULL\")\n+endif()\n+\n+check_function_exists(setenv SETENV)\n+print_bool(SETENV)\n+if(NOT SETENV)\n+  list(APPEND compat_defs \"-DNO_SETENV\")\n+  list(APPEND compat_src \"compat/setenv.c\")\n+endif()\n+\n+check_function_exists(unsetenv UNSETENV)\n+print_bool(UNSETENV)\n+if(NOT UNSETENV)\n+  list(APPEND compat_defs \"-DNO_UNSETENV\")\n+  list(APPEND compat_src \"compat/unsetenv.c\")\n+endif()\n+\n+check_function_exists(mkdtemp MKDTEMP)\n+print_bool(MKDTEMP)\n+if(NOT MKDTEMP)\n+  list(APPEND compat_defs \"-DNO_MKDTEMP\")\n+  list(APPEND compat_src \"compat/mkdtemp.c\")\n+endif()\n+\n+check_function_exists(initgroups INITGROUPS)\n+print_bool(INITGROUPS)\n+if(NOT INITGROUPS)\n+  list(APPEND compat_defs \"-DNO_INITGROUPS\")\n+endif()\n+\n+if(NOT CMAKE_CROSSCOMPILING)\n+  set(test_dir_path \"${CMAKE_CURRENT_BINARY_DIR}/mkdir_test_dir\")\n+  try_run(mkdir_run_result\n+          mkdir_compile_result\n+          \"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp\"\n+          \"${CMAKE_CURRENT_SOURCE_DIR}/cmake/mkdir_test.c\"\n+          COMPILE_OUTPUT_VARIABLE mkdir_compile_output\n+          ARGS \"${test_dir_path}/\")\n+  if(mkdir_compile_result)\n+    if(mkdir_run_result EQUAL 0 AND IS_DIRECTORY \"${test_dir_path}\")\n+      file(REMOVE_RECURSE \"${test_dir_path}\")\n+      set(MKDIR_W_TRAILING_SLASH ON)\n+    endif()\n+  else()\n+    message(WARNING \"Failed to compile mkdir_test: ${mkdir_compile_output}\")\n+  endif()\n+endif()\n+print_bool(MKDIR_W_TRAILING_SLASH)\n+if(NOT MKDIR_W_TRAILING_SLASH)\n+  list(APPEND compat_defs \"-DMKDIR_WO_TRAILING_SLASH\")\n+  list(APPEND compat_src \"compat/mkdir.c\")\n+endif()\n+\n+check_struct_has_member(\"struct passwd\" pw_gecos \"pwd.h\" GECOS_IN_PWENT)\n+print_bool(GECOS_IN_PWENT)\n+if(NOT GECOS_IN_PWENT)\n+  list(APPEND basic_defs \"-DNO_GECOS_IN_PWENT\")\n+endif()\n+\n+check_include_file(\"libgen.h\" LIBGEN_H)\n+print_bool(LIBGEN_H)\n+if(NOT LIBGEN_H)\n+  list(APPEND compat_defs \"-DNO_LIBGEN_H\")\n+  list(APPEND compat_src \"compat/basename.c\")\n+endif()\n+\n+check_function_exists(dirname libc_has_dirname)\n+if(NOT libc_has_dirname)\n+  set(NEEDS_LIBGEN ON)\n+endif()\n+print_bool(NEEDS_LIBGEN)\n+if(NEEDS_LIBGEN)\n+  list(APPEND libs gen)\n+endif()\n+\n+check_include_file(\"sys/select.h\" SYS_SELECT_H)\n+print_bool(SYS_SELECT_H)\n+if(NOT SYS_SELECT_H)\n+  list(APPEND basic_defs \"-DNO_SYS_SELECT_H\")\n+endif()\n+\n+if(NOT WIN32)\n+  set(not_windows ON)\n+endif()\n+cmake_dependent_option(\n+  SYMLINK_HEAD \"Occasionally use symbolic link for .git/HEAD\" ON\n+  \"not_windows\" OFF)\n+print_bool(SYMLINK_HEAD)\n+if(NOT SYMLINK_HEAD)\n+  list(APPEND basic_defs \"-DNO_SYMLINK_HEAD\")\n+endif()\n+\n+option(SVN_TESTS \"Build time-consuming SVN tests\" ON)\n+print_bool(SVN_TESTS)\n+\n+if(CMAKE_SYSTEM_NAME STREQUAL \"Darwin\")\n+  set(doc_template \"Use @tool@ installations when present in @location@ for\")\n+  set(doc_template \"${doc_template} includes/libraries\")\n+\n+  set(tool \"Fink\")\n+  set(location \"/sw\")\n+  string(CONFIGURE doc_string \"${doc_template}\")\n+  option(FINK \"${doc_string}\" ON)\n+  print_bool(FINK)\n+  if(FINK AND IS_DIRECTORY \"/sw\")\n+    if(IS_DIRECTORY \"/sw/include\")\n+      list(APPEND include_dirs \"/sw/include\")\n+    endif()\n+    if(IS_DIRECTORY \"/sw/lib\")\n+      list(APPEND link_dirs \"/sw/lib\")\n+    endif()\n+  endif()\n+\n+  set(tool \"DarwinPorts\")\n+  set(location \"/opt/local\")\n+  string(CONFIGURE doc_string \"${doc_template}\")\n+  option(DARWIN_PORTS \"${doc_string}\" ON)\n+  print_bool(DARWIN_PORTS)\n+  if(DARWIN_PORTS AND IS_DIRECTORY \"/opt/local\")\n+    if(IS_DIRECTORY \"/opt/local/include\")\n+      list(APPEND include_dirs \"/opt/local/include\")\n+    endif()\n+    if(IS_DIRECTORY \"/opt/local/lib\")\n+      list(APPEND link_dirs \"/opt/local/lib\")\n+    endif()\n+  endif()\n+\n+  option(APPLE_COMMON_CRYPTO \"Use Apple's CommonCrypto library\" ON)\n+  print_bool(APPLE_COMMON_CRYPTO)\n+  if(APPLE_COMMON_CRYPTO)\n+    list(APPEND compat_defs \"-DAPPLE_COMMON_CRYPTO\")\n+  else()\n+    set(not_apple_common_crypto ON)\n+  endif()\n+endif()\n+\n+set(doc_string\n+    \"Limit the amount of data that will be hashed in one call to the \"\n+    \"platform's SHA1_Update()\")\n+if(APPLE_COMMON_CRYPTO)\n+  set(SHA1_MAX_BLOCK_SIZE \"1024L*1024L*1024L\" CACHE STRING \"${doc_string}\")\n+else()\n+  set(SHA1_MAX_BLOCK_SIZE \"\" CACHE STRING \"${doc_string}\")\n+endif()\n+\n+if(SHA1_MAX_BLOCK_SIZE)\n+  list(APPEND basic_defs \"-DSHA1_MAX_BLOCK_SIZE=\\\"${SHA1_MAX_BLOCK_SIZE}\\\"\")\n+  list(APPEND lib_src \"compat/sha1-chunked.c\")\n+endif()\n+\n+if(OPENSSL)\n+  set(sha1_default_implementation \"OPENSSL_SHA1\")\n+else()\n+  set(sha1_default_implementation \"BLK_SHA1\")\n+endif()\n+set(SHA1_IMPLEMENTATION \"${sha1_default_implementation}\" CACHE STRING\n+    \"Source to use for SHA1 implementation\")\n+set_property(CACHE SHA1_IMPLEMENTATION PROPERTY STRINGS\n+             \"OPENSSL_SHA1;BLK_SHA1;PPC_SHA1;DC_SHA1\")\n+message(STATUS \"SHA1_IMPLEMENTATION: ${SHA1_IMPLEMENTATION}\")\n+if(SHA1_IMPLEMENTATION STREQUAL \"DC_SHA1\")\n+  set(DC_SHA1_EXTERNAL \"\" CACHE STRING \"external SHA1 collision-detect library\")\n+  set(doc_string\n+      \"use the sha1collisiondetection shipped as a submodule instead of the\")\n+  set(doc_string \"${doc_string} non-submodule copy in sha1dc\")\n+  message(STATUS \"DC_SHA1_EXTERNAL: ${DC_SHA1_EXTERNAL}\")\n+\n+  option(DC_SHA1_SUBMODULE \"${doc_string}\" OFF)\n+  print_bool(DC_SHA1_SUBMODULE)\n+endif()\n+\n+if(SHA1_IMPLEMENTATION STREQUAL \"OPENSSL_SHA1\")\n+  list(APPEND include_dirs ${OPENSSL_INCLUDE_DIRS})\n+  list(APPEND libs ${OPENSSL_LIBRARIES})\n+  list(APPEND basic_defs \"-DSHA1_OPENSSL\")\n+elseif(SHA1_IMPLEMENTATION STREQUAL \"BLK_SHA1\")\n+  list(APPEND lib_src \"block-sha1/sha1.c\")\n+  list(APPEND basic_defs \"-DSHA1_BLK\")\n+elseif(SHA1_IMPLEMENTATION STREQUAL \"PPC_SHA1\")\n+  list(APPEND lib_src\n+       \"ppc/sha1.c\"\n+       \"ppc/sha1ppc.c\")\n+  list(APPEND basic_defs \"-DSHA1_PPC\")\n+elseif(SHA1_IMPLEMENTATION STREQUAL \"APPLE_COMMON_CRYPTO\")\n+  list(APPEND compat_defs \"-DCOMMON_DIGEST_FOR_OPENSSL\")\n+  list(APPEND basic_defs \"-DSHA1_APPLE\")\n+else()\n+  if(NOT SHA1_IMPLEMENTATION STREQUAL \"DC_SHA1\")\n+    message(FATAL_ERROR \"Invalid SHA1_IMPLEMENTATION: ${SHA1_IMPLEMENTATION}\")\n+  endif()\n+  list(APPEND basic_defs \"-DSHA1_DC\")\n+  list(APPEND lib_src \"sha1dc_git.c\")\n+\n+  if(DC_SHA1_EXTERNAL)\n+    if(DC_SHA1_SUBMODULE)\n+      message(FATAL_ERROR\n+        \"Only set DC_SHA1_EXTERNAL or DC_SHA1_SUBMODULE, not both\")\n+    endif()\n+    list(APPEND basic_defs \"-DDC_SHA1_EXTERNAL\")\n+    list(APPEND libs sha1detectcoll)\n+  elseif(DC_SHA1_SUBMODULE)\n+    list(APPEND lib_src\n+         \"sha1collisiondetection/lib/sha1.c\"\n+         \"sha1collisiondetection/lib/ubc_check.c\")\n+    list(APPEND basic_defs \"-DDC_SHA1_SUBMODULE\")\n+  else()\n+    list(APPEND lib_src\n+         \"sha1collisiondetection/sha1.c\"\n+         \"sha1collisiondetection/ubc_check.c\")\n+  endif()\n+  list(APPEND basic_defs\n+       \"-DSHA1DC_NO_STANDARD_INCLUDES\"\n+       \"-DSHA1DC_INIT_SAFE_HASH_DEFAULT=0\"\n+       \"-DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\\\"cache.h\\\"\"\n+       \"-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\\\"git-compat-util.h\\\"\")\n+endif()\n+\n+set(CMAKE_EXTRA_INCLUDE_FILES \"stdint.h\")\n+\n+check_type_size(intptr_t INTPTR_T)\n+print_bool(INTPTR_T)\n+if(NOT INTPTR_T)\n+  list(APPEND compat_defs \"-DNO_INTPTR_T\")\n+endif()\n+\n+check_type_size(uintmax_t UINTMAX_T)\n+print_bool(UINTMAX_T)\n+if(NOT UINTMAX_T)\n+  list(APPEND compat_defs \"-Duintmax_t=uint32_t\")\n+endif()\n+\n+set(CMAKE_EXTRA_INCLUDE_FILES)\n+\n+check_function_exists(mmap have_mmap)\n+cmake_dependent_option(MMAP \"Use mmap\" ON \"have_mmap\" OFF)\n+print_bool(MMAP)\n+\n+cmake_dependent_option(\n+  USE_WIN32_MMAP \"Use Windows mmap\" OFF \"WIN32;MMAP\" OFF)\n+if(MMAP)\n+  if(USE_WIN32_MMAP)\n+    list(APPEND compat_defs \"-DUSE_WIN32_MMAP\")\n+    list(APPEND compat_src \"compat/win32mmap.c\")\n+  endif()\n+else()\n+  list(APPEND compat_defs \"-DNO_MMAP\")\n+  list(APPEND compat_src \"compat/mmap.c\")\n+endif()\n+\n+if(MMAP)\n+  if(CMAKE_CROSSCOMPILING)\n+    set(MMAP_PREVENTS_DELETE ON)\n+  else()\n+    file(COPY \"${CMAKE_CURRENT_SOURCE_DIR}/cmake/mmap_test.c\"\n+         DESTINATION \"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp\")\n+    try_run(mmap_run_result\n+            mmap_compile_result\n+            \"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp\"\n+            \"${CMAKE_CURRENT_SOURCE_DIR}/cmake/mmap_test.c\"\n+            COMPILE_OUTPUT_VARIABLE mmap_compile_output\n+            ARGS \"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/mmap_test.c\")\n+    if(mmap_compile_result)\n+      if(NOT mmap_run_result EQUAL 0)\n+        set(MMAP_PREVENTS_DELETE ON)\n+      endif()\n+    else()\n+      message(WARNING \"Failed to compile mmap_test: ${mmap_compile_output}\")\n+      set(MMAP_PREVENTS_DELETE ON)\n+    endif()\n+  endif()\n+  print_bool(MMAP_PREVENTS_DELETE)\n+endif()\n+\n+if(MMAP_PREVENTS_DELETE)\n+  list(APPEND basic_defs \"-DMMAP_PREVENTS_DELETE\")\n+endif()\n+\n+option(POLL \"Use poll()\" ON)\n+if(POLL)\n+  check_include_file(\"sys/poll.h\" SYS_POLL_H)\n+  print_bool(SYS_POLL_H)\n+  if(NOT SYS_POLL_H)\n+    list(APPEND basic_defs \"-DNO_SYS_POLL_H\")\n+  endif()\n+else()\n+  list(APPEND compat_defs \"-DNO_POLL\")\n+  list(APPEND compat_include_dirs \"compat/poll\")\n+  list(APPEND compat_src \"compat/poll/poll.c\")\n+endif()\n+\n+if(NOT SYS_POLL_H)\n+  list(APPEND basic_defs \"-DNO_SYS_POLL_H\")\n+endif()\n+\n+find_package(Threads)\n+cmake_dependent_option(PTHREADS \"Use pthreads\" ON \"CMAKE_USE_PTHREADS_INIT\" OFF)\n+print_bool(PTHREADS)\n+\n+if(PTHREADS)\n+  list(APPEND libs Threads::Threads)\n+  list(APPEND lib_src \"thread-utils.c\")\n+else()\n+  list(APPEND basic_defs \"-DNO_PTHREADS\")\n+endif()\n+\n+check_function_exists(pread have_pread)\n+cmake_dependent_option(PREAD \"Use pread system call\" ON \"have_pread\" OFF)\n+print_bool(PREAD)\n+if(NOT PREAD)\n+  list(APPEND compat_defs \"-DNO_PREAD\")\n+  list(APPEND compat_src \"compat/pread.c\")\n+endif()\n+\n+set(CMAKE_EXTRA_INCLUDE_FILES \"sys/time.h\")\n+check_type_size(\"struct itimerval\" STRUCT_ITIMERVAL)\n+print_bool(STRUCT_ITIMERVAL)\n+set(CMAKE_EXTRA_INCLUDE_FILES)\n+if(STRUCT_ITIMERVAL)\n+  check_function_exists(setitimer SETITIMER)\n+  print_bool(SETITIMER)\n+else()\n+  list(APPEND \"-DNO_STRUCT_ITIMERVAL\")\n+endif()\n+\n+if(NOT SETITIMER)\n+  list(APPEND compat_defs \"-DNO_SETITIMER\")\n+endif()\n+\n+option(FAST_WORKING_DIRECTORY\n+  \"Accessing working directory is faster than accessing objects in pack files\"\n+  ON)\n+print_bool(FAST_WORKING_DIRECTORY)\n+if(NOT FAST_WORKING_DIRECTORY)\n+  list(APPEND basic_defs \"-DNO_FAST_WORKING_DIRECTORY\")\n+endif()\n+\n+option(TRUSTABLE_FILEMODE \"Filesystem supports executable file mode\" ON)\n+print_bool(TRUSTABLE_FILEMODE)\n+if(NOT TRUSTABLE_FILEMODE)\n+  list(APPEND basic_defs \"-DNO_TRUSTABLE_FILEMODE\")\n+endif()\n+\n+option(NEEDS_MODE_TRANSLATION\n+       \"OS strays from the typical file type bits in mode values\"\n+       OFF)\n+print_bool(NEEDS_MODE_TRANSLATION)\n+if(NEEDS_MODE_TRANSLATION)\n+  list(APPEND compat_defs \"-DNEEDS_MODE_TRANSLATION\")\n+  list(APPEND compat_src \"compat/stat.c\")\n+endif()\n+\n+option(IPV6 \"System supports IPv6\" ON)\n+print_bool(IPV6)\n+if(NOT IPV6)\n+  list(APPEND basic_defs \"-DNO_IPV6\")\n+endif()\n+\n+check_function_exists(inet_ntop HAVE_INET_NTOP)\n+if(NOT HAVE_INET_NTOP)\n+  list(APPEND lib_src \"compat/inet_ntop.c\")\n+  list(APPEND basic_defs \"-DNO_INET_NTOP\")\n+endif()\n+\n+check_function_exists(inet_pton HAVE_INET_PTON)\n+if(NOT HAVE_INET_PTON)\n+  list(APPEND lib_src \"compat/inet_pton.c\")\n+  list(APPEND basic_defs \"-DNO_INET_PTON\")\n+endif()\n+\n+check_symbol_exists(AF_UNIX \"${socket_headers}\" UNIX_SOCKETS)\n+print_bool(UNIX_SOCKETS)\n+if(UNIX_SOCKETS)\n+  list(APPEND lib_src \"unix-socket.c\")\n+  list(APPEND program_src\n+       \"credential-cache.c\"\n+       \"credential-cache--daemon.c\")\n+endif()\n+\n+set(CMAKE_EXTRA_INCLUDE_FILES \"${socket_headers}\")\n+check_type_size(\"struct sockaddr\" SOCKADDR_STORAGE)\n+set(CMAKE_EXTRA_INCLUDE_FILES)\n+print_bool(SOCKADDR_STORAGE)\n+if(NOT SOCKADDR_STORAGE)\n+  if(IPV6)\n+    list(APPEND basic_defs \"-Dsockaddr_storage=sockaddr_in6\")\n+  else()\n+    list(APPEND basic_defs \"-Dsockaddr_storage=sockaddr_in\")\n+  endif()\n+endif()\n+\n+check_include_file(\"iconv.h\" have_iconv_h)\n+if(have_iconv_h)\n+  try_compile(new_iconv\n+    \"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp\"\n+    SOURCES \"${CMAKE_CURRENT_SOURCE_DIR}/cmake/iconv_test.c\"\n+    COMPILE_DEFINITIONS \"-DCONST=\"\n+    LINK_LIBRARIES $<$<BOOL:${iconv_lib}>:${iconv_lib}>\n+    OUTPUT_VARIABLE new_iconv_output)\n+  if(NOT new_iconv)\n+    try_compile(OLD_ICONV\n+      \"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp\"\n+      SOURCES \"${CMAKE_CURRENT_SOURCE_DIR}/cmake/iconv_test.c\"\n+      COMPILE_DEFINITIONS \"-DCONST=const\"\n+      LINK_LIBRARIES $<$<BOOL:${iconv_lib}>:${iconv_lib}>\n+      OUTPUT_VARIABLE old_iconv_output)\n+    if(NOT OLD_ICONV)\n+      message(WARNING \"Cannot compile call to iconv\"\n+              \"New iconv test output: ${new_iconv_output}\"\n+              \"Old iconv test output: ${old_iconv_output}\")\n+      set(NO_ICONV ON)\n+    endif()\n+  endif()\n+else()\n+  set(NO_ICONV ON)\n+endif()\n+print_bool(OLD_ICONV)\n+print_bool(NO_ICONV)\n+\n+if(NO_ICONV)\n+  list(APPEND basic_defs \"-DNO_ICONV\")\n+endif()\n+\n+if(OLD_ICONV)\n+  list(APPEND basic_defs \"-DOLD_ICONV\")\n+endif()\n+\n+if(NOT NO_ICONV AND iconv_lib)\n+  list(APPEND libs \"${iconv_lib}\")\n+endif()\n+\n+if(UNIX)\n+  set(POSIX_GOODIES ON)\n+endif()\n+print_bool(POSIX_GOODIES)\n+\n+if(NOT POSIX_GOODIES)\n+  list(APPEND basic_defs \"-DNO_POSIX_GOODIES\")\n+endif()\n+\n+find_package(ZLIB)\n+if(ZLIB_FOUND)\n+  list(APPEND include_dirs ${ZLIB_INCLUDE_DIRS})\n+  list(APPEND libs ${ZLIB_LIBRARIES})\n+\n+  set(CMAKE_REQUIRED_LIBRARIES \"${ZLIB_LIBRARIES}\")\n+  check_function_exists(deflateBound DEFLATE_BOUND)\n+  set(CMAKE_REQUIRED_LIBRARIES)\n+  if(NOT DEFLATE_BOUND)\n+    list(APPEND basic_defs \"-DNO_DEFLATE_BOUND\")\n+  endif()\n+endif()\n+print_bool(DEFLATE_BOUND)\n+\n+option(NORETURN \"Use of attribute((__noreturn__))\" ON)\n+print_bool(NORETURN)\n+if(NOT NORETURN)\n+  list(APPEND basic_defs \"-DNO_NORETURN\")\n+endif()\n+\n+check_struct_has_member(\"struct stat\" st_ctimespec \"sys/stat.h\" USE_ST_TIMESPEC)\n+print_bool(USE_ST_TIMESPEC)\n+if(USE_ST_TIMESPEC)\n+  list(APPEND basic_defs \"-DUSE_ST_TIMESPEC\")\n+endif()\n+\n+check_struct_has_member(\"struct stat\" \"st_ctim.tv_nsec\" \"sys/stat.h\" HAVE_NSEC)\n+print_bool(HAVE_NSEC)\n+if(NOT HAVE_NSEC)\n+  list(APPEND basic_defs \"-DNO_NSEC\")\n+endif()\n+\n+cmake_dependent_option(\n+  USE_NSEC \"Use subsecond file mtimes and ctimes\" OFF \"HAVE_NSEC\" OFF)\n+print_bool(USE_NSEC)\n+if(USE_NSEC)\n+  list(APPEND basic_defs \"-DUSE_NSEC\")\n+endif()\n+\n+check_struct_has_member(\n+  \"struct stat\" st_blocks \"sys/stat.h\" ST_BLOCKS_IN_STRUCT_STAT)\n+print_bool(ST_BLOCKS_IN_STRUCT_STAT)\n+if(NOT ST_BLOCKS_IN_STRUCT_STAT)\n+  list(APPEND basic_defs \"-DNO_ST_BLOCKS_IN_STRUCT_STAT\")\n+endif()\n+\n+find_program(PERL_PATH perl)\n+message(STATUS \"PERL_PATH: ${PERL_PATH}\")\n+\n+cmake_dependent_option(PERL \"Enable Perl scripts and libraries\" ON\n+                       \"PERL_PATH\" OFF)\n+print_bool(PERL)\n+\n+find_program(PYTHON_PATH python)\n+message(STATUS \"PYTHON_PATH: ${PYTHON_PATH}\")\n+\n+cmake_dependent_option(PYTHON \"Enable Python scripts and libraries\" ON\n+                       \"PYTHON_PATH\" OFF)\n+print_bool(PYTHON)\n+\n+find_package(TCL)\n+set(TCLTK_PATH \"${TK_WISH}\")\n+message(STATUS \"TCLTK_PATH: ${TCLTK_PATH}\")\n+\n+cmake_dependent_option(TCLTK \"Enable Tcl/Tk GUI\" ON \"TCLTK_PATH\" OFF)\n+print_bool(TCLTK)\n+if(TCLTK)\n+  set(TCL_PATH \"${TCL_TCLSH}\")\n+  message(STATUS \"TCL_PATH: ${TCL_PATH}\")\n+endif()\n+\n+set(doc_string \"Set to -a if using recent versions of GNU grep that are picky\")\n+set(doc_string \"${doc_string} with non-ASCII data\")\n+set(SANE_TEXT_GREP \"\" CACHE STRING \"${doc_string}\")\n+message(STATUS \"SANE_TEXT_GREP: ${SANE_TEXT_GREP}\")\n+\n+option(INTERNAL_QSORT \"Use git's internal qsort\" OFF)\n+print_bool(INTERNAL_QSORT)\n+if(INTERNAL_QSORT)\n+  list(APPEND compat_defs \"-DINTERNAL_QSORT\")\n+  list(APPEND compat_src \"compat/qsort.c\")\n+endif()\n+\n+check_function_exists(qsort_s HAVE_ISO_QSORT_S)\n+print_bool(HAVE_ISO_QSORT_S)\n+if(HAVE_ISO_QSORT_S)\n+  list(APPEND compat_defs \"-DHAVE_ISO_QSORT_S\")\n+else()\n+  list(APPEND compat_src \"compat/qsort_s.c\")\n+endif()\n+\n+if(NOT CMAKE_CROSSCOMPILING)\n+  try_run(fstat_run_result\n+          fstat_compile_result\n+          \"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp\"\n+          \"${CMAKE_CURRENT_SOURCE_DIR}/cmake/fstat_test.c\"\n+          COMPILE_OUTPUT_VARIABLE fstat_compile_output\n+          ARGS \"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/fstat_tmp.txt\")\n+  if(fstat_compile_result)\n+    if(fstat_run_result EQUAL 0)\n+      set(UNRELIABLE_FSTAT ON)\n+    endif()\n+  else()\n+    message(WARNING \"Cannot compile fstat_test: ${fstat_compile_output}\")\n+  endif()\n+endif()\n+print_bool(UNRELIABLE_FSTAT)\n+if(UNRELIABLE_FSTAT)\n+  list(APPEND basic_defs \"-DUNRELIABLE_FSTAT\")\n+endif()\n+\n+cmake_dependent_option(\n+  OBJECT_CREATION_USES_RENAMES\n+  \"Use file rename instead of hardlink with immediate unlink\"\n+  OFF\n+  \"not_windows\"\n+  ON)\n+print_bool(OBJECT_CREATION_USES_RENAMES)\n+if(OBJECT_CREATION_USES_RENAMES)\n+  list(APPEND compat_defs \"-DOBJECT_CREATION_MODE=1\")\n+endif()\n+\n+option(USE_NED_ALLOCATOR\n+       \"Use nedmalloc allocator instead of platform allocator\"\n+       OFF)\n+print_bool(USE_NED_ALLOCATOR)\n+\n+if(USE_NED_ALLOCATOR)\n+  list(APPEND compat_include_dirs\n+       \"compat/nedmalloc\")\n+  list(APPEND compat_src\n+       \"compat/nedmalloc/nedmalloc.c\")\n+endif()\n+\n+if(NOT USE_NED_ALLOCATOR)\n+  set(not_use_ned_allocator ON)\n+endif()\n+cmake_dependent_option(\n+  OVERRIDE_STRDUP \"Override libc strdup\" OFF \"not_use_ned_allocator\" ON)\n+print_bool(OVERRIDE_STRDUP)\n+\n+if(OVERRIDE_STRDUP)\n+  list(APPEND compat_defs \"-DOVERRIDE_STRDUP\")\n+  list(APPEND compat_src \"compat/strdup.c\")\n+endif()\n+\n+check_symbol_exists(REG_STARTEND \"regex.h\" REGEX)\n+print_bool(REGEX)\n+\n+if(NOT REGEX)\n+  list(APPEND compat_include_dirs \"compat/regex\")\n+  list(APPEND compat_src \"compat/regex/regex.c\")\n+endif()\n+\n+if(CMAKE_SYSTEM_NAME MATCHES \"Linux|Darwin|SunOS\")\n+  set(default_have_dev_tty ON)\n+else()\n+  set(default_have_dev_tty OFF)\n+endif()\n+option(\n+  HAVE_DEV_TTY\n+  \"System can open /dev/tty to interact with user\"\n+  ${default_have_dev_tty})\n+print_bool(HAVE_DEV_TTY)\n+if(HAVE_DEV_TTY)\n+  list(APPEND basic_defs \"-DHAVE_DEV_TTY\")\n+endif()\n+\n+option(GETTEXT_POISON \"Debug choice of strings marked for translation\" OFF)\n+print_bool(GETTEXT_POISON)\n+if(GETTEXT_POISON)\n+  list(APPEND basic_defs \"-DGETTEXT_POISON\")\n+endif()\n+\n+find_program(LESS_PATH less)\n+set(DEFAULT_PAGER \"${LESS_PATH}\" CACHE FILEPATH \"Sensible pager command\")\n+list(APPEND basic_defs \"-DDEFAULT_PAGER=\\\"${DEFAULT_PAGER}\\\"\")\n+message(STATUS \"DEFAULT_PAGER: ${DEFAULT_PAGER}\")\n+\n+find_program(VI_PATH vi)\n+set(DEFAULT_EDITOR \"${VI_PATH}\" CACHE FILEPATH \"Sensible editor command\")\n+list(APPEND basic_defs \"-DDEFAULT_EDITOR=\\\"${DEFAULT_EDITOR}\\\"\")\n+message(STATUS \"DEFAULT_EDITOR: ${DEFAULT_EDITOR}\")\n+\n+if(WIN32 OR MINGW)\n+  set(NATIVE_CRLF ON)\n+endif()\n+print_bool(NATIVE_CRLF)\n+\n+if(NATIVE_CRLF)\n+  list(APPEND basic_defs \"-DNATIVE_CRLF\")\n+endif()\n+\n+set(help_formats man info html)\n+set(DEFAULT_HELP_FORMAT \"man\" CACHE FILEPATH \"\\\"git help\\\" format\")\n+set_property(CACHE DEFAULT_HELP_FORMAT PROPERTY STRINGS \"${help_formats}\")\n+message(STATUS \"DEFAULT_HELP_FORMAT: ${DEFAULT_HELP_FORMAT}\")\n+list(APPEND basic_defs \"-DDEFAULT_HELP_FORMAT=\\\"${DEFAULT_HELP_FORMAT}\\\"\")\n+\n+set(TEST_GIT_INDEX_VERSION \"\" CACHE STRING \"Version of indexfile to test\")\n+set_property(CACHE TEST_GIT_INDEX_VERSION PROPERTY STRINGS \"2;3;4\")\n+\n+if(NOT CMAKE_CROSSCOMPILING)\n+  try_run(gmtime_run_result\n+          gmtime_compile_result\n+          \"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp\"\n+          \"${CMAKE_CURRENT_SOURCE_DIR}/cmake/gmtime_test.c\"\n+          COMPILE_OUTPUT_VARIABLE gmtime_compile_output)\n+  if(gmtime_compile_result)\n+    if(gmtime_run_result EQUAL 0)\n+      set(GMTIME_UNRELIABLE_ERRORS ON)\n+    endif()\n+  else()\n+    message(WARNING \"Cannot compile gmtime_test: ${gmtime_compile_output}\")\n+  endif()\n+endif()\n+print_bool(GMTIME_UNRELIABLE_ERRORS)\n+\n+if(GMTIME_UNRELIABLE_ERRORS)\n+  list(APPEND compat_defs \"-DGMTIME_UNRELIABLE_ERRORS\")\n+  list(APPEND compat_src \"compat/gmtime.c\")\n+endif()\n+\n+check_function_exists(clock_gettime libc_has_clock_gettime)\n+if(libc_has_clock_gettime)\n+  set(HAVE_CLOCK_GETTIME ON)\n+else()\n+  set(CMAKE_REQUIRED_LIBRARIES rt)\n+  check_function_exists(clock_gettime librt_has_clock_gettime)\n+  if(librt_has_clock_gettime)\n+    set(HAVE_CLOCK_GETTIME ON)\n+    set(NEEDS_LIBRT ON)\n+  endif()\n+endif()\n+print_bool(HAVE_CLOCK_GETTIME)\n+print_bool(NEEDS_LIBRT)\n+\n+if(HAVE_CLOCK_GETTIME)\n+  list(APPEND basic_defs \"-DHAVE_CLOCK_GETTIME\")\n+endif()\n+\n+if(NEEDS_LIBRT)\n+  list(APPEND libs rt)\n+endif()\n+\n+check_symbol_exists(CLOCK_MONOTONIC \"time.h\" HAVE_CLOCK_MONOTONIC)\n+print_bool(HAVE_CLOCK_MONOTONIC)\n+\n+if(HAVE_CLOCK_MONOTONIC)\n+  list(APPEND basic_defs \"-DHAVE_CLOCK_MONOTONIC\")\n+endif()\n+\n+try_compile(USE_PARENS_AROUND_GETTEXT_N\n+  \"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp\"\n+  SOURCES \"${CMAKE_CURRENT_SOURCE_DIR}/cmake/parens_test.c\")\n+print_bool(USE_PARENS_AROUND_GETTEXT_N)\n+if(USE_PARENS_AROUND_GETTEXT_N)\n+  list(APPEND basic_defs \"-DUSE_PARENS_AROUND_GETTEXT_N=1\")\n+else()\n+  list(APPEND basic_defs \"-DUSE_PARENS_AROUND_GETTEXT_N=0\")\n+endif()\n+\n+try_compile(HAVE_BSD_SYSCTL\n+  \"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp\"\n+  SOURCES \"${CMAKE_CURRENT_SOURCE_DIR}/cmake/sysctl_test.c\")\n+print_bool(HAVE_BSD_SYSCTL)\n+\n+if(HAVE_BSD_SYSCTL)\n+  list(APPEND basic_defs \"-DHAVE_BSD_SYSCTL\")\n+endif()\n+\n+check_function_exists(getdelim HAVE_GETDELIM)\n+print_bool(HAVE_GETDELIM)\n+\n+if(HAVE_GETDELIM)\n+  list(APPEND basic_defs \"-DHAVE_GETDELIM\")\n+endif()\n+\n+set(doc_string \"SP separated VAR=VAL pairs to define default environment\")\n+set(doc_string \"${doc_string} variables to be passed when a pager is spawned\")\n+set(PAGER_ENV \"LESS=FRX LV=-c\" CACHE STRING \"${doc_string}\")\n+message(STATUS \"PAGER_ENV: ${PAGER_ENV}\")\n+list(APPEND basic_defs \"-DPAGER_ENV=\\\"${PAGER_ENV}\\\"\")\n+\n+find_program(SHELL_PATH sh)\n+message(STATUS \"SHELL_PATH: ${SHELL_PATH}\")\n+list(APPEND basic_defs \"-DSHELL_PATH=\\\"${SHELL_PATH}\\\"\")\n+\n+# Build rules\n+\n+list(APPEND lib_src ${compat_src})\n+list(APPEND basic_defs ${compat_defs})\n+\n+add_library(libgit STATIC ${lib_src})\n+\n+set(xdiff_src\n+  \"xdiff/xdiffi.c\"\n+  \"xdiff/xprepare.c\"\n+  \"xdiff/xutils.c\"\n+  \"xdiff/xemit.c\"\n+  \"xdiff/xmerge.c\"\n+  \"xdiff/xpatience.c\"\n+  \"xdiff/xhistogram.c\")\n+add_library(xdiff STATIC ${xdiff_src})\n+target_compile_definitions(xdiff PUBLIC ${basic_defs})\n+target_include_directories(xdiff PUBLIC ${compat_include_dirs})\n+target_link_libraries(xdiff PUBLIC ${libs})\n+\n+set(vcssvn_src\n+  \"vcs-svn/line_buffer.c\"\n+  \"vcs-svn/sliding_window.c\"\n+  \"vcs-svn/fast_export.c\"\n+  \"vcs-svn/svndiff.c\"\n+  \"vcs-svn/svndump.c\")\n+add_library(vcssvn STATIC ${vcssvn_src})\n+target_compile_definitions(vcssvn PUBLIC ${basic_defs})\n+target_include_directories(vcssvn PUBLIC ${compat_include_dirs})\n+target_link_libraries(vcssvn PUBLIC ${libs})\n+\n+target_compile_definitions(libgit PUBLIC ${basic_defs})\n+target_include_directories(libgit PUBLIC ${compat_include_dirs})\n+target_link_libraries(libgit PUBLIC ${libs})\n+\n+set(src_defs\n+    \"GIT_HTML_PATH=\\\"${html_dir}\\\"\"\n+    \"GIT_MAN_PATH=\\\"${man_dir}\\\"\"\n+    \"GIT_INFO_PATH=\\\"${info_dir}\\\"\")\n+set_source_files_properties(\n+  \"git.c\" \"builtin/help.c\"\n+  PROPERTIES\n+  COMPILE_DEFINITIONS \"${src_defs}\")\n+\n+set(src_defs\n+    \"GIT_VERSION=\\\"${GIT_VERSION}\\\"\"\n+    \"GIT_USER_AGENT=\\\"${GIT_USER_AGENT}\\\"\"\n+    \"GIT_BUILT_FROM_COMMIT=\\\"${GIT_BUILT_FROM_COMMIT}\\\"\")\n+set_source_files_properties(\n+  \"version.c\"\n+  PROPERTIES\n+  COMPILE_DEFINITIONS \"${src_defs}\")\n+\n+set(src_defs\n+    \"GIT_EXEC_PATH=\\\"${git_exec_dir}\\\"\"\n+    \"BINDIR=\\\"${bin_dir}\\\"\"\n+    \"PREFIX=\\\"${CMAKE_INSTALL_PREFIX}\\\"\")\n+set_source_files_properties(\n+  \"exec_cmd.c\"\n+  PROPERTIES\n+  COMPILE_DEFINITIONS \"${src_defs}\")\n+\n+set_source_files_properties(\n+  \"builtin/init-db.c\"\n+  PROPERTIES\n+  COMPILE_DEFINITIONS \"DEFAULT_GIT_TEMPLATE_DIR=\\\"${template_dir}\\\"\")\n+\n+set_source_files_properties(\n+  \"config.c\"\n+  PROPERTIES\n+  COMPILE_DEFINITIONS \"ETC_GITCONFIG=\\\"${etc_gitconfig}\\\"\")\n+\n+set_source_files_properties(\n+  \"attr.c\"\n+  PROPERTIES\n+  COMPILE_DEFINITIONS \"ETC_GITATTRIBUTES=\\\"${etc_gitattributes}\\\"\")\n+\n+set_source_files_properties(\n+  \"gettext.c\"\n+  PROPERTIES\n+  COMPILE_DEFINITIONS \"GIT_LOCALE_PATH=\\\"${locale_dir}\\\"\")\n+\n+# TODO: Sparse\n+if(SPARSE)\n+  set_source_files_properties(\n+    \"http-push.c\" \"http.c\" \"http-walker.c\" \"remote-curl.c\" \"imap-send.c\"\n+    PROPERTIES\n+    COMPILE_DEFINITIONS \"CURL_DISABLE_TYPECHECK\")\n+endif()\n+\n+if(NOT EXPAT)\n+  set_source_files_properties(\n+    \"http-walker.c\"\n+    PROPERTIES\n+    COMPILE_DEFINITIONS \"NO_EXPAT\")\n+endif()\n+\n+if(NOT REGEX)\n+  set_source_files_properties(\n+    \"compat/regex/regex.c\"\n+    PROPERTIES\n+    COMPILE_DEFINITIONS \"GAWK;NO_MBSUPPORT\")\n+endif()\n+\n+if(USE_NED_ALLOCATOR)\n+  if(SPARSE)\n+    add_c_flag(SPARSE_FLAGS \"-Wno-non-pointer-null\")\n+  endif()\n+  set_source_files_properties(\n+    \"compat/nedmalloc/nedmalloc.c\"\n+    PROPERTIES\n+    COMPILE_DEFINITIONS \"NDEBUG;REPLACE_SYSTEM_ALLOCATOR\"\n+    COMPILE_FLAGS \"${SPARSE_FLAGS}\")\n+  # TODO: Decide how this relates to Debug/Release modes\n+endif()\n+\n+add_library(common-main \"common-main.c\" ${builtin_src})\n+target_link_libraries(common-main PUBLIC libgit xdiff)\n+\n+add_executable(git \"git.c\")\n+target_link_libraries(git PUBLIC common-main)\n+\n+add_executable(git-imap-send \"imap-send.c\" ${imap_send_builddeps})\n+target_link_libraries(git-imap-send PUBLIC ${imap_send_libs} common-main)\n+\n+if(CURL)\n+  add_executable(git-http-fetch \"http.c\" \"http-walker.c\" \"http-fetch.c\")\n+  target_include_directories(git-http-fetch PUBLIC ${CURL_INCLUDE_DIRS})\n+  target_link_libraries(git-http-fetch PUBLIC ${CURL_LIBRARIES} common-main)\n+\n+  if(EXPAT)\n+    if(CURL_VERSION_STRING VERSION_GREATER_EQUAL \"7.9.8\")\n+      add_executable(git-http-push \"http.c\" \"http-push.c\")\n+      target_include_directories(git-http-push PUBLIC\n+        ${CURL_INCLUDE_DIRS} ${EXPAT_INCLUDE_DIRS})\n+      target_link_libraries(git-http-push PUBLIC\n+        ${CURL_LIBRARIES} ${EXPAT_LIBRARIES} common-main)\n+    endif()\n+\n+    add_executable(git-remote-http \"remote-curl.c\" \"http.c\" \"http-walker.c\")\n+    target_link_libraries(git-remote-http PUBLIC\n+      ${CURL_LIBRARIES} ${EXPAT_LIBRARIES} common-main)\n+    foreach(remote_curl_alias \"git-remote-https\" \"git-remote-ftp\"\n+            \"git-remote-ftps\")\n+      if(UNIX)\n+        set(cmake_subcommand \"create_symlink\")\n+      else()\n+        set(cmake_subcommand \"copy\")\n+      endif()\n+      add_custom_command(\n+        TARGET git-remote-http\n+        POST_BUILD\n+        COMMAND ${CMAKE_COMMAND} -E ${cmake_subcommand}\n+                git-remote-http \"${remote_curl_alias}\"\n+        VERBATIM\n+        WORKING_DIRECTORY \"${CMAKE_CURRENT_BINARY_DIR}\")\n+    endforeach()\n+  endif()\n+endif()\n+\n+add_executable(git-remote-testsvn \"remote-testsvn.c\")\n+target_link_libraries(git-remote-testsvn PUBLIC common-main vcssvn)\n+\n+foreach(src ${program_src})\n+  get_filename_component(base \"${src}\" NAME_WE)\n+  add_executable(\"git-${base}\" \"${src}\")\n+  target_link_libraries(\"git-${base}\" PUBLIC common-main)\n+endforeach()\n+\n+foreach(src ${builtin_src})\n+  get_filename_component(base \"${src}\" NAME_WE)\n+  if(UNIX)\n+    set(cmake_subcommand \"create_symlink\")\n+  else()\n+    set(cmake_subcommand \"copy\")\n+  endif()\n+\n+  set(src \"git\")\n+  set(dst \"git-${base}\")\n+  add_custom_command(\n+    TARGET git POST_BUILD\n+    COMMAND ${CMAKE_COMMAND} -E ${cmake_subcommand} \"${src}\" \"${dst}\"\n+    VERBATIM\n+    WORKING_DIRECTORY \"${CMAKE_CURRENT_BINARY_DIR}\")\n+  install(PROGRAMS \"${CMAKE_CURRENT_BINARY_DIR}/${dst}\"\n+          DESTINATION \"${bin_dir}\")\n+endforeach()\n+\n+# Scripts\n+\n+find_program(DIFF diff)\n+message(STATUS \"DIFF: ${DIFF}\")\n+\n+set(doc_string \"Set to colon-separated list of paths to prepend to PATH if\")\n+set(doc_string \"${doc_string} your tools in /usr/bin are broken\")\n+set(SANE_TOOL_PATH \"\" CACHE STRING \"${doc_string}\")\n+\n+function(fix_shebang script_path program_path output_content)\n+  file(STRINGS \"${script_path}\" line LIMIT_COUNT 1)\n+  string(LENGTH \"${line}\" offset)\n+  file(READ \"${script_path}\" content OFFSET ${offset})\n+  if(line MATCHES \"#!\")\n+    set(${output_content} \"#!${program_path}${content}\" PARENT_SCOPE)\n+  else()\n+    set(${output_content} \"${line}${content}\" PARENT_SCOPE)\n+  endif()\n+endfunction()\n+\n+function(munge_script script_path output_name)\n+  fix_shebang(\"${script_path}\" \"${SHELL_PATH}\" script_content)\n+  string(REPLACE \"@SHELL_PATH@\" \"${SHELL_PATH}\"\n+         script_content \"${script_content}\")\n+  string(REPLACE \"@@DIFF@@\" \"${DIFF}\" script_content \"${script_content}\")\n+  string(REPLACE \"@@LOCALEDIR@@\" \"${locale_dir}\"\n+         script_content \"${script_content}\")\n+  string(REPLACE \"@@NO_CURL@@\" \"${NO_CURL}\"\n+         script_content \"${script_content}\")\n+  if(USE_GETTEXT_SCHEME_FALLTHROUGH)\n+    string(REPLACE \"@@USE_GETTEXT_SCHEME@@\" \"fallthrough\"\n+           script_content \"${script_content}\")\n+  endif()\n+\n+  if(SANE_TOOL_PATH)\n+    set(broken_path_fix \"git_broken_path_fix ${SANE_TOOL_PATH}\")\n+  endif()\n+  string(REGEX REPLACE \"^# @@BROKEN_PATH_FIX@@$\" \"${broken_path_fix}\"\n+         script_content \"${script_content}\")\n+\n+  string(REPLACE \"@@GITWEBDIR@@\" \"${gitweb_dir}\"\n+         script_content \"${script_content}\")\n+  string(REPLACE \"@@PERL@@\" \"${PERL}\" script_content \"${script_content}\")\n+  string(REPLACE \"@@SANE_TEXT_GREP@@\" \"${SANE_TEXT_GREP}\"\n+         script_content \"${script_content}\")\n+  string(REPLACE \"@@PAGER_ENV@@\" \"${PAGER_ENV}\"\n+         script_content \"${script_content}\")\n+\n+  file(GENERATE OUTPUT \"${CMAKE_CURRENT_BINARY_DIR}/${output_name}\"\n+       CONTENT \"${script_content}\")\n+endfunction()\n+\n+list(APPEND script_sh \"git-bisect.sh\")\n+list(APPEND script_sh \"git-difftool--helper.sh\")\n+list(APPEND script_sh \"git-filter-branch.sh\")\n+list(APPEND script_sh \"git-merge-octopus.sh\")\n+list(APPEND script_sh \"git-merge-one-file.sh\")\n+list(APPEND script_sh \"git-merge-resolve.sh\")\n+list(APPEND script_sh \"git-mergetool.sh\")\n+list(APPEND script_sh \"git-quiltimport.sh\")\n+list(APPEND script_sh \"git-rebase.sh\")\n+list(APPEND script_sh \"git-remote-testgit.sh\")\n+list(APPEND script_sh \"git-request-pull.sh\")\n+list(APPEND script_sh \"git-stash.sh\")\n+list(APPEND script_sh \"git-submodule.sh\")\n+list(APPEND script_sh \"git-web--browse.sh\")\n+\n+list(APPEND script_lib \"git-mergetool--lib.sh\")\n+list(APPEND script_lib \"git-parse-remote.sh\")\n+list(APPEND script_lib \"git-rebase--am.sh\")\n+list(APPEND script_lib \"git-rebase--interactive.sh\")\n+list(APPEND script_lib \"git-rebase--merge.sh\")\n+list(APPEND script_lib \"git-sh-setup.sh\")\n+list(APPEND script_lib \"git-sh-i18n.sh\")\n+\n+foreach(script_path ${script_sh})\n+  get_filename_component(output_name \"${script_path}\" NAME_WE)\n+  munge_script(\"${script_path}\" \"${output_name}\")\n+  if(NOT script_path STREQUAL\n+     \"git-remote-testgit.sh\")\n+    install(PROGRAMS \"${CMAKE_CURRENT_BINARY_DIR}/${output_name}\"\n+            DESTINATION \"${git_exec_dir}\")\n+  endif()\n+endforeach()\n+foreach(script_path ${script_lib})\n+  get_filename_component(output_name \"${script_path}\" NAME_WE)\n+  munge_script(\"${script_path}\" \"${output_name}\")\n+  install(FILES \"${CMAKE_CURRENT_BINARY_DIR}/${output_name}\"\n+          DESTINATION \"${git_exec_dir}\")\n+endforeach()\n+install(FILES ${script_lib_gen} DESTINATION \"${git_exec_dir}\")\n+\n+list(APPEND script_perl \"git-add--interactive.perl\")\n+list(APPEND script_perl \"git-archimport.perl\")\n+list(APPEND script_perl \"git-cvsexportcommit.perl\")\n+list(APPEND script_perl \"git-cvsimport.perl\")\n+list(APPEND script_perl \"git-cvsserver.perl\")\n+list(APPEND script_perl \"git-send-email.perl\")\n+list(APPEND script_perl \"git-svn.perl\")\n+if(PERL)\n+  foreach(script_path ${script_perl})\n+    fix_shebang(\"${script_path}\" \"${PERL_PATH}\" script_content)\n+    string(FIND \"${script_content}\" \"\\n\" first_line_ending)\n+    string(SUBSTRING \"${script_content}\" 0 ${first_line_ending} first_line)\n+    string(SUBSTRING \"${script_content}\" ${first_line_ending} -1 rest_of_script)\n+    # ${lib_dir} relative to ${git_exec_dir} is \"../../${lib_dir}\"\n+    string(CONCAT script_content\n+      \"${first_line}\\n\"\n+      \"use FindBin;\\n\"\n+      \"use lib (split(/$(pathsep)/, \\$ENV{GITPERLLIB} || \"\n+      \"\\\"$FindBin::Bin/../../${lib_dir}\\\"));\"\n+      \"${rest_of_script}\")\n+    string(REPLACE \"@@GIT_VERSION@@\" \"${GIT_VERSION}\"\n+           script_content \"${script_content}\")\n+    string(REPLACE \"$<\" \"$UID\" script_content \"${script_content}\")\n+\n+    get_filename_component(output_name \"${script_path}\" NAME_WE)\n+    file(GENERATE OUTPUT \"${CMAKE_CURRENT_BINARY_DIR}/${output_name}\"\n+         CONTENT \"${script_content}\")\n+    install(PROGRAMS \"${CMAKE_CURRENT_BINARY_DIR}/${output_name}\"\n+            DESTINATION \"${git_exec_dir}\")\n+  endforeach()\n+else()\n+  foreach(script_path ${script_perl})\n+    fix_shebang(\"unimplemented.sh\"\n+                \"${SHELL_PATH}\" script_content)\n+    string(REPLACE \"@@REASON@@\" \"PERL=OFF\" script_content \"${script_content}\")\n+    get_filename_component(output_name \"${script_path}\" NAME_WE)\n+    file(GENERATE OUTPUT \"${CMAKE_CURRENT_BINARY_DIR}/${output_name}\"\n+         CONTENT \"${script_content}\")\n+    install(PROGRAMS \"${CMAKE_CURRENT_BINARY_DIR}/${output_name}\"\n+            DESTINATION \"${git_exec_dir}\")\n+  endforeach()\n+endif()\n+\n+list(APPEND script_python \"git-p4.py\")\n+if(PYTHON)\n+  foreach(script_path ${script_python})\n+    fix_shebang(\"${script_path}\" \"${PYTHON_PATH}\" script_content)\n+    get_filename_component(output_name \"${script_path}\" NAME_WE)\n+    file(GENERATE OUTPUT \"${CMAKE_CURRENT_BINARY_DIR}/${output_name}\"\n+         CONTENT \"${script_content}\")\n+    install(PROGRAMS \"${CMAKE_CURRENT_BINARY_DIR}/${output_name}\"\n+            DESTINATION \"${git_exec_dir}\")\n+  endforeach()\n+else()\n+  foreach(script_path ${script_python})\n+    fix_shebang(\"unimplemented.sh\"\n+                \"${SHELL_PATH}\" script_content)\n+    string(REPLACE \"@@REASON@@\" \"PYTHON=OFF\" script_content \"${script_content}\")\n+    get_filename_component(output_name \"${script_path}\" NAME_WE)\n+    file(GENERATE OUTPUT \"${CMAKE_CURRENT_BINARY_DIR}/${output_name}\"\n+         CONTENT \"${script_content}\")\n+    install(PROGRAMS \"${CMAKE_CURRENT_BINARY_DIR}/${output_name}\"\n+            DESTINATION \"${git_exec_dir}\")\n+  endforeach()\n+endif()\ndiff --git a/cmake/GenerateCmdlist.cmake b/cmake/GenerateCmdlist.cmake\nnew file mode 100644\nindex 000000000..1063627b1\n--- /dev/null\n+++ b/cmake/GenerateCmdlist.cmake\n@@ -0,0 +1,83 @@\n+if(__generate_cmdlist)\n+  return()\n+endif()\n+set(__generate_cmdlist 1)\n+\n+function(generate_cmdlist)\n+  string(CONCAT cmdlist_content\n+\"/* Automatically generated by cmake/generate-cmdlist.cmake */\n+struct cmdname_help {\n+\tchar name[16];\n+\tchar help[80];\n+\tunsigned char group;\n+};\n+\n+static const char *common_cmd_groups[] = {\")\n+\n+  set(group_pattern \"^([^ ]+)[ ]+(.+)[ ]*$\")\n+  set(command_pattern \"^([^ ]+)[ ]+[^ ]+[ ]+([^ ]+)[ ]*$\")\n+\n+  file(STRINGS \"${CMAKE_CURRENT_SOURCE_DIR}/command-list.txt\" lines)\n+  foreach(line ${lines})\n+    if(line MATCHES \"^### common groups\")\n+      set(context \"groups\")\n+    elseif(line MATCHES \"^### command list\")\n+      set(context \"commands\")\n+    endif()\n+\n+    if(line AND NOT line MATCHES \"^#\")\n+      if(context STREQUAL \"groups\")\n+        string(REGEX REPLACE \"${group_pattern}\" \"\\\\1\" group \"${line}\")\n+        string(REGEX REPLACE \"${group_pattern}\" \"\\\\2\" doc_string \"${line}\")\n+        if(group)\n+          list(APPEND groups \"${group}\")\n+          list(APPEND group_docs \"${doc_string}\")\n+        endif()\n+      elseif(context STREQUAL \"commands\")\n+        if(line MATCHES \"${command_pattern}\")\n+          string(REGEX REPLACE \"${command_pattern}\" \"\\\\1\" command \"${line}\")\n+          string(REGEX REPLACE \"${command_pattern}\" \"\\\\2\" group_name \"${line}\")\n+          list(APPEND commands \"${command}\")\n+          list(APPEND command_group_names \"${group_name}\")\n+        endif()\n+      endif()\n+    endif()\n+  endforeach()\n+\n+  list(LENGTH groups num_groups)\n+  math(EXPR num_groups \"${num_groups} - 1\")\n+  foreach(group_index RANGE ${num_groups})\n+    list(GET group_docs ${group_index} doc_string)\n+    set(cmdlist_content \"${cmdlist_content}\n+\tN_(\\\"${doc_string}\\\"),\")\n+  endforeach()\n+\n+  set(cmdlist_content \"${cmdlist_content}\n+};\n+\n+static struct cmdname_help common_cmds[] = {\")\n+\n+  list(LENGTH commands num_commands)\n+  math(EXPR num_commands \"${num_commands} - 1\")\n+  foreach(command_index RANGE ${num_commands})\n+    list(GET commands ${command_index} command)\n+    list(GET command_group_names ${command_index} group_name)\n+    list(FIND groups ${group_name} group_index)\n+    if(NOT group_index EQUAL -1)\n+      string(REPLACE \"git-\" \"\" command_no_git \"${command}\")\n+      file(STRINGS \"${CMAKE_CURRENT_SOURCE_DIR}/Documentation/${command}.txt\"\n+           doc_string\n+           LIMIT_COUNT 1\n+           REGEX \"^${command} -\")\n+      string(REGEX REPLACE \"^${command} - \" \"\" doc_string \"${doc_string}\")\n+      set(cmdlist_content \"${cmdlist_content}\n+\t{\\\"${command_no_git}\\\", N_(\\\"${doc_string}\\\"), ${group_index}},\")\n+    endif()\n+  endforeach()\n+\n+  set(cmdlist_content \"${cmdlist_content}\n+};\n+\")\n+  file(GENERATE OUTPUT \"${CMAKE_CURRENT_BINARY_DIR}/common-cmds.h\"\n+       CONTENT \"${cmdlist_content}\")\n+endfunction()\ndiff --git a/cmake/fopen_dir_test.c b/cmake/fopen_dir_test.c\nnew file mode 100644\nindex 000000000..7c8de4eb7\n--- /dev/null\n+++ b/cmake/fopen_dir_test.c\n@@ -0,0 +1,11 @@\n+#include <stdio.h>\n+\n+int main(int argc, char* argv[])\n+{\n+\tFILE* f = fopen(argv[1], \"r\");\n+\tif (f != NULL) {\n+\t\tfclose(f);\n+\t\treturn 0;\n+\t}\n+\treturn 1;\n+}\ndiff --git a/cmake/fstat_test.c b/cmake/fstat_test.c\nnew file mode 100644\nindex 000000000..629e18f34\n--- /dev/null\n+++ b/cmake/fstat_test.c\n@@ -0,0 +1,37 @@\n+#include <fcntl.h>\n+#include <stdlib.h>\n+#include <string.h>\n+#include <sys/stat.h>\n+#include <unistd.h>\n+\n+int main(int argc, const char **argv)\n+{\n+\tint fd = open(argv[1], O_WRONLY);\n+\tif (fd == -1) {\n+\t\treturn EXIT_FAILURE;\n+\t}\n+\n+\tconst char *data = \"hello world\\n\";\n+\tint data_length = strlen(data);\n+\tssize_t written = write(fd, data, data_length);\n+\tif (written != data_length) {\n+\t\tclose(fd);\n+\t\treturn EXIT_FAILURE;\n+\t}\n+\n+\tstruct stat fstat_result;\n+\tif (fstat(fd, &fstat_result) != 0) {\n+\t\tclose(fd);\n+\t\treturn EXIT_FAILURE;\n+\t}\n+\n+\tclose(fd);\n+\tstruct stat lstat_result;\n+\tif (lstat(argv[1], &lstat_result) != 0) {\n+\t\treturn EXIT_FAILURE;\n+\t}\n+\n+\t/* Only returns 0 if fstat_result != lstat_result */\n+\treturn (fstat_result.st_mtime != lstat_result.st_mtime) ||\n+\t\t   (fstat_result.st_ctime != lstat_result.st_ctime);\n+}\ndiff --git a/cmake/gmtime_test.c b/cmake/gmtime_test.c\nnew file mode 100644\nindex 000000000..1a490c3f2\n--- /dev/null\n+++ b/cmake/gmtime_test.c\n@@ -0,0 +1,7 @@\n+#include <time.h>\n+\n+int main()\n+{\n+\ttime_t time = -1;\n+\treturn gmtime(&time) != NULL;\n+}\ndiff --git a/cmake/iconv_test.c b/cmake/iconv_test.c\nnew file mode 100644\nindex 000000000..efa8402ac\n--- /dev/null\n+++ b/cmake/iconv_test.c\n@@ -0,0 +1,13 @@\n+#include <iconv.h>\n+#include <stdlib.h>\n+\n+int main()\n+{\n+    iconv_t cd = NULL;\n+    CONST char* in_buf = NULL;\n+    size_t in_bytes_left = 0;\n+    size_t out_bytes_left = 0;\n+    char* out_buf = NULL;\n+    iconv(cd, &in_buf, &in_bytes_left, &out_buf, &out_bytes_left);\n+\treturn 0;\n+}\ndiff --git a/cmake/inline_test.c b/cmake/inline_test.c\nnew file mode 100644\nindex 000000000..73cdfb444\n--- /dev/null\n+++ b/cmake/inline_test.c\n@@ -0,0 +1,9 @@\n+static INLINE void foo()\n+{\n+}\n+\n+int main(int argc, char* argv[])\n+{\n+\tfoo();\n+\treturn 0;\n+}\ndiff --git a/cmake/mkdir_test.c b/cmake/mkdir_test.c\nnew file mode 100644\nindex 000000000..d81d141c3\n--- /dev/null\n+++ b/cmake/mkdir_test.c\n@@ -0,0 +1,7 @@\n+#include <sys/stat.h>\n+#include <sys/types.h>\n+\n+int main(int argc, char* argv[])\n+{\n+\treturn mkdir(argv[1], S_IRWXO);\n+}\ndiff --git a/cmake/mmap_test.c b/cmake/mmap_test.c\nnew file mode 100644\nindex 000000000..208d9a375\n--- /dev/null\n+++ b/cmake/mmap_test.c\n@@ -0,0 +1,35 @@\n+#include <sys/stat.h>\n+#include <sys/mman.h>\n+#include <fcntl.h>\n+#include <stdio.h>\n+#include <stdlib.h>\n+#include <unistd.h>\n+\n+int main(int argc, const char **argv)\n+{\n+\tstruct stat sb;\n+\n+\tint fd = open(argv[1], O_RDONLY);\n+\tif (fd == -1) {\n+\t\treturn EXIT_FAILURE;\n+\t}\n+\n+\tif (fstat(fd, &sb) == -1) {\n+\t\tclose(fd);\n+\t\treturn EXIT_FAILURE;\n+\t}\n+\n+\tvoid *addr = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0);\n+\tif (addr == MAP_FAILED) {\n+\t\tclose(fd);\n+\t\treturn EXIT_FAILURE;\n+\t}\n+\n+\tint result = remove(argv[1]);\n+\tmunmap(addr, sb.st_size);\n+\tif (result != 0) {\n+\t\tclose(fd);\n+\t\treturn EXIT_FAILURE;\n+\t}\n+\treturn 0;\n+}\ndiff --git a/cmake/parens_test.c b/cmake/parens_test.c\nnew file mode 100644\nindex 000000000..5ec555763\n--- /dev/null\n+++ b/cmake/parens_test.c\n@@ -0,0 +1,6 @@\n+int main()\n+{\n+    static const char s[] = (\"FOO\");\n+    (void) s;\n+\treturn 0;\n+}\ndiff --git a/cmake/snprintf_test.c b/cmake/snprintf_test.c\nnew file mode 100644\nindex 000000000..3ad943d62\n--- /dev/null\n+++ b/cmake/snprintf_test.c\n@@ -0,0 +1,7 @@\n+#include <stdio.h>\n+\n+int main()\n+{\n+\tchar buf[1];\n+\treturn snprintf(&buf[0], sizeof(buf), \"%d\", 16);\n+}\ndiff --git a/cmake/sysctl_test.c b/cmake/sysctl_test.c\nnew file mode 100644\nindex 000000000..868cfaff8\n--- /dev/null\n+++ b/cmake/sysctl_test.c\n@@ -0,0 +1,11 @@\n+#include <stdlib.h>\n+#include <sys/sysctl.h>\n+#include <sys/types.h>\n+\n+int main()\n+{\n+\tint mib[2] = { 0, 0 };\n+\tsize_t len = 0;\n+\tint cpucount = 0;\n+\treturn sysctl(mib, 2, &cpucount, &len, NULL, 0);\n+}\n-- \n2.14.1\n\n"},{"id":"337261","messageId":"CAG6xkCZn6m2n0rDvpN6MmZcOr2hJBRCfhrppC37f-DUj3_JZsw@mail.gmail.com","threadId":"47671","inReplyTo":"20180123001648.24260-1-isaachier@gmail.com","subject":"Re: [RFC PATCH 0/1] Implement CMake build","fromName":"Isaac Hier","fromEmail":"isaachier@gmail.com","sentAt":"2018-01-24T13:45:03Z","receivedAt":"2018-01-24T13:45:11Z","isPatch":true,"sender":{"key":"isaachier@gmail.com","avatar":null},"body":"I realize this is a huge patch, but does anyone have feedback for the\ngeneral idea?\n\nOn Mon, Jan 22, 2018 at 7:16 PM, Isaac Hier <isaachier@gmail.com> wrote:\n> This patch adds a mostly complete (aside from building tests, documentation,\n> installation, etc.) CMake build to the git project. I am not sure how much\n> interest there is in a CMake build, so please send me feedback one way or\n> another. Personally, I believe CMake will help with Windows builds and is\n> somewhat easier to read than a Makefile. I considered, adding this to the\n> contrib directory, but CMakeLists.txt almost always reside in the original\n> directories, and I'm not sure how wise it would be to do otherwise. If you are\n> interested in a CMake build, I would be more than happy to finish up the work\n> here. Decided to wait until I discussed the issue here to finish the final parts\n> of the build.\n>\n> Isaac Hier (1):\n>   Implement CMake build\n>\n>  CMakeLists.txt              | 1849 +++++++++++++++++++++++++++++++++++++++++++\n>  cmake/GenerateCmdlist.cmake |   83 ++\n>  cmake/fopen_dir_test.c      |   11 +\n>  cmake/fstat_test.c          |   37 +\n>  cmake/gmtime_test.c         |    7 +\n>  cmake/iconv_test.c          |   13 +\n>  cmake/inline_test.c         |    9 +\n>  cmake/mkdir_test.c          |    7 +\n>  cmake/mmap_test.c           |   35 +\n>  cmake/parens_test.c         |    6 +\n>  cmake/snprintf_test.c       |    7 +\n>  cmake/sysctl_test.c         |   11 +\n>  12 files changed, 2075 insertions(+)\n>  create mode 100644 CMakeLists.txt\n>  create mode 100644 cmake/GenerateCmdlist.cmake\n>  create mode 100644 cmake/fopen_dir_test.c\n>  create mode 100644 cmake/fstat_test.c\n>  create mode 100644 cmake/gmtime_test.c\n>  create mode 100644 cmake/iconv_test.c\n>  create mode 100644 cmake/inline_test.c\n>  create mode 100644 cmake/mkdir_test.c\n>  create mode 100644 cmake/mmap_test.c\n>  create mode 100644 cmake/parens_test.c\n>  create mode 100644 cmake/snprintf_test.c\n>  create mode 100644 cmake/sysctl_test.c\n>\n> --\n> 2.14.1\n>\n"},{"id":"337277","messageId":"CA+P7+xq2eucumKT1VRymvnwv0KoauiYsmko-s=UAChoQ3X3w1g@mail.gmail.com","threadId":"47671","inReplyTo":"CAG6xkCZn6m2n0rDvpN6MmZcOr2hJBRCfhrppC37f-DUj3_JZsw@mail.gmail.com","subject":"Re: [RFC PATCH 0/1] Implement CMake build","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2018-01-24T18:11:19Z","receivedAt":"2018-01-24T18:11:45Z","isPatch":true,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Wed, Jan 24, 2018 at 5:45 AM, Isaac Hier <isaachier@gmail.com> wrote:\n> I realize this is a huge patch, but does anyone have feedback for the\n> general idea?\n>\n\nI don't know anything about CMake so I can't comment on the patch\nitself. Having additional build systems does not bother me, but it\ndoes mean that someone has to maintain the build system and try to\nkeep it in sync with changes that occur to the main one in use. That\ncan be problematic.\n\nPersonally, if we added a new build system, I think I'd prefer\nsomething like meson with ninja, but that's only because of the\nexamples I've seen where build times were improved significantly. I\nhave no idea what advantages CMake would give on this front.\n\nThanks,\nJake\n"},{"id":"337280","messageId":"xmqqpo5zdrgm.fsf@gitster.mtv.corp.google.com","threadId":"47671","inReplyTo":"CAG6xkCZn6m2n0rDvpN6MmZcOr2hJBRCfhrppC37f-DUj3_JZsw@mail.gmail.com","subject":"Re: [RFC PATCH 0/1] Implement CMake build","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-01-24T18:47:21Z","receivedAt":"2018-01-24T18:47:30Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Isaac Hier <isaachier@gmail.com> writes:\n\n> I realize this is a huge patch, but does anyone have feedback for the\n> general idea?\n\nI personally am not interested, especially with the justification\ngiven in the cover letter.\n\nPerhaps the one in this patch may be \"mostly complete\", and I am\nsure you can make it \"complete\" against a frozen target, but it is\nunclear to me how you envision keeping the completeness up to date.\n\nWhenever a developer needs to introduce a new build knob, the\nsupport for it needs to be implemented in not just Makefile but now\nalso in this other thing.  Unless there is an automated\nbi-directional gateway to allow those who have been writing and\nreading Makefile not to worry about those who wants to build with\nCMake, and vice versa, you are forcing everybody to do the same work\ntwice, no?\n\nChoice of build procedure for a project is like choise of SCM to\nstore its source file.  If the new system is 10x better to make it\nworthwhile to educate everybody to use it, switching to a new system\nand ditching the current one *is* a reasonable thing to propose and\nconsider.\n\nBut I do not think you are proposing to switch, and I do not think\nyou are convincingly arguing that it is 10x better than the current\none, either.  \n"},{"id":"337286","messageId":"675fa58d-bff3-d7e4-5fac-ecf1401932f4@jeffhostetler.com","threadId":"47671","inReplyTo":"20180123001648.24260-1-isaachier@gmail.com","subject":"Re: [RFC PATCH 0/1] Implement CMake build","fromName":"Jeff Hostetler","fromEmail":"git@jeffhostetler.com","sentAt":"2018-01-24T19:36:58Z","receivedAt":"2018-01-24T19:37:06Z","isPatch":true,"sender":{"key":"git@jeffhostetler.com","avatar":null},"body":"\n\nOn 1/22/2018 7:16 PM, Isaac Hier wrote:\n> This patch adds a mostly complete (aside from building tests, documentation,\n> installation, etc.) CMake build to the git project. I am not sure how much\n> interest there is in a CMake build, so please send me feedback one way or\n> another. Personally, I believe CMake will help with Windows builds and is\n> somewhat easier to read than a Makefile. I considered, adding this to the\n> contrib directory, but CMakeLists.txt almost always reside in the original\n> directories, and I'm not sure how wise it would be to do otherwise. If you are\n> interested in a CMake build, I would be more than happy to finish up the work\n> here. Decided to wait until I discussed the issue here to finish the final parts\n> of the build.\n\nOn Windows, we use \"bash\" and \"make\" from the Git-for-Windows SDK installation\n(which gives us a bash shell and most of the usual Unix command line tools) and\nthe main \"Makefile\".  We do need a special section in the \"config.mak.uname\" file\nto set some platform compiler options and etc., but that is small enough.\n\nJohannes and I recently added a few new options to let Windows build Git from\nthe command line with either GCC or MSVC and to synthesize MSVS solution (.sln)\nand project (.vcxproj) files to allow you to work with the full MSVS IDE and\nfull intellisense.  And if necessary download and build third-party libraries\nnot normally present on a Windows machine.  Most of this work is Windows specific\nand may not yet be upstream.   See GfW [1] and VCPKG [2].\n\nThe synthesized solution and project files are automatically generated, so we\ndo not have to separately track changes in the Makefile to the various file lists.\nThese should be treated as read-only and re-generated in response to changes in\nthe Makefile.  Using the solution/project files, we can completely build Git in\nthe IDE or a command prompt and without the SDK.  This further simplifies things\nfor Windows developers.\n\nSo given that, I don't see a need to replace the main Makefile on Windows.\n\nSorry,\nJeff\n\n[1] https://github.com/git-for-windows/git\n[2] https://github.com/Microsoft/vcpkg\n"},{"id":"337292","messageId":"CAG6xkCbe+pLwTCButZGdPucHoRCq-a8mWfifd6z2bzGZNseE9A@mail.gmail.com","threadId":"47671","inReplyTo":"675fa58d-bff3-d7e4-5fac-ecf1401932f4@jeffhostetler.com","subject":"Re: [RFC PATCH 0/1] Implement CMake build","fromName":"Isaac Hier","fromEmail":"isaachier@gmail.com","sentAt":"2018-01-24T19:59:24Z","receivedAt":"2018-01-24T19:59:32Z","isPatch":true,"sender":{"key":"isaachier@gmail.com","avatar":null},"body":"Jeff, no worries, fair enough. I know https://github.com/grpc/grpc\nuses a shared file to generate code for several build systems instead\nof maintaining them individually. I plan on doing the work anyway just\nbecause I have my own reasons to use CMake in Git (for packaging in\nhttps://github.com/ruslo/hunter is my main motive here). Whether or\nnot it is maintained upstream is not a real concern for me at the\nmoment.\n\nJunio, in terms of maintainability, yes that is my main concern as\nwell. I proposed this here knowing that might be the main issue. From\nmy point of view, CMake is a much better choice than Makefile + uname\noverrides, but if no one cares for learning CMake, you are correct\nthat it will not be maintained.\n\nIn terms of the benefits of CMake, let me highlight some examples I\nnoticed while porting this:\n\n* Makefiles rely on hard-coded paths. CMake does not (uses find,\nconfigs, etc. to alleviate path-related issues). One clear example is\nthe way the Makefile has to exclude certain package manager paths on\nMac (i.e. fink and ports).\n* Makefiles do not have a good way of finding dependencies or checking\nversions. Compare these two choices.\n   Makefile: curl_check := $(shell (echo 070908; $(CURL_CONFIG)\n--vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne\n2p)\n   CMakeLists.txt:  if(CURL AND CURL_VERSION_STRING\nVERSION_GREATER_EQUAL \"7.22.0\")\n* Makefile cannot use compilation results to drive build.\nconfig.mak.uname needs to be updated each and every time to delineate\nacceptable builds.\n* CMake can automatically produce a compilation database for clang\ntools (iwyu, clang-tidy, etc.).\n* CMake is procedural and generates a dataflow Makefile. Procedural\nprogramming is a little more intuitive IMO, especially true for C\nprogrammers :). Case in point, debugging a Makefile is a lot harder\nthan debugging CMake.\n* CMake is compatible with non-Unix/Windows platforms.\n\nMy point isn't to convert you, just to explain why CMake has taken\nover in many many projects over the last decade. I agree that if there\nis no maintainer, do not accept this patch. I'm only offering it in\ncase there is any interest. It seems like there isn't at the moment.\nI'll see how the Windows build currently works and if that makes\nsense, maybe I'll try using that build generator here too.\n\nThanks for the feedback,\n\nIsaac\n\nOn Wed, Jan 24, 2018 at 2:36 PM, Jeff Hostetler <git@jeffhostetler.com> wrote:\n>\n>\n> On 1/22/2018 7:16 PM, Isaac Hier wrote:\n>>\n>> This patch adds a mostly complete (aside from building tests,\n>> documentation,\n>> installation, etc.) CMake build to the git project. I am not sure how much\n>> interest there is in a CMake build, so please send me feedback one way or\n>> another. Personally, I believe CMake will help with Windows builds and is\n>> somewhat easier to read than a Makefile. I considered, adding this to the\n>> contrib directory, but CMakeLists.txt almost always reside in the original\n>> directories, and I'm not sure how wise it would be to do otherwise. If you\n>> are\n>> interested in a CMake build, I would be more than happy to finish up the\n>> work\n>> here. Decided to wait until I discussed the issue here to finish the final\n>> parts\n>> of the build.\n>\n>\n> On Windows, we use \"bash\" and \"make\" from the Git-for-Windows SDK\n> installation\n> (which gives us a bash shell and most of the usual Unix command line tools)\n> and\n> the main \"Makefile\".  We do need a special section in the \"config.mak.uname\"\n> file\n> to set some platform compiler options and etc., but that is small enough.\n>\n> Johannes and I recently added a few new options to let Windows build Git\n> from\n> the command line with either GCC or MSVC and to synthesize MSVS solution\n> (.sln)\n> and project (.vcxproj) files to allow you to work with the full MSVS IDE and\n> full intellisense.  And if necessary download and build third-party\n> libraries\n> not normally present on a Windows machine.  Most of this work is Windows\n> specific\n> and may not yet be upstream.   See GfW [1] and VCPKG [2].\n>\n> The synthesized solution and project files are automatically generated, so\n> we\n> do not have to separately track changes in the Makefile to the various file\n> lists.\n> These should be treated as read-only and re-generated in response to changes\n> in\n> the Makefile.  Using the solution/project files, we can completely build Git\n> in\n> the IDE or a command prompt and without the SDK.  This further simplifies\n> things\n> for Windows developers.\n>\n> So given that, I don't see a need to replace the main Makefile on Windows.\n>\n> Sorry,\n> Jeff\n>\n> [1] https://github.com/git-for-windows/git\n> [2] https://github.com/Microsoft/vcpkg\n"},{"id":"337304","messageId":"87a7x3kmh5.fsf@evledraar.gmail.com","threadId":"47671","inReplyTo":"xmqqpo5zdrgm.fsf@gitster.mtv.corp.google.com","subject":"Re: [RFC PATCH 0/1] Implement CMake build","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-01-24T20:53:10Z","receivedAt":"2018-01-24T20:53:34Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Wed, Jan 24 2018, Junio C. Hamano jotted:\n\n> Isaac Hier <isaachier@gmail.com> writes:\n>\n>> I realize this is a huge patch, but does anyone have feedback for the\n>> general idea?\n>\n> I personally am not interested, especially with the justification\n> given in the cover letter.\n>\n> Perhaps the one in this patch may be \"mostly complete\", and I am\n> sure you can make it \"complete\" against a frozen target, but it is\n> unclear to me how you envision keeping the completeness up to date.\n>\n> Whenever a developer needs to introduce a new build knob, the\n> support for it needs to be implemented in not just Makefile but now\n> also in this other thing.  Unless there is an automated\n> bi-directional gateway to allow those who have been writing and\n> reading Makefile not to worry about those who wants to build with\n> CMake, and vice versa, you are forcing everybody to do the same work\n> twice, no?\n>\n> Choice of build procedure for a project is like choise of SCM to\n> store its source file.  If the new system is 10x better to make it\n> worthwhile to educate everybody to use it, switching to a new system\n> and ditching the current one *is* a reasonable thing to propose and\n> consider.\n>\n> But I do not think you are proposing to switch, and I do not think\n> you are convincingly arguing that it is 10x better than the current\n> one, either.\n\nThere's more than 400 lines of instructions at the top of our current\nMakfile. Most of that is of the form \"if your system has/doesn't have\nso-and-so, define so-and-so\".\n\nFor whatever reason we've decided not to make autoconf a hard\ndependency. I don't know/remember what those reasons are, but if we\ncould get *some* build system that could use compilation results to\ndrive its build that would be worth it.\n\nI don't know if cmake is that system, i.e. if we could waive a magic\nwand and replace our current build system with it whether we'd still\nneed a fallback Makefile on some platforms. Is it as portable as GNU\nautoconf & make? I don't know.\n\nIt would be very nice if git's build system wouldn't require patches\nlike my fb95e2e38d (\"grep: un-break building with PCRE >= 8.32 without\n--enable-jit\", 2017-06-01), which is only needed because we don't have a\nway to run a small C program to determine what the value of something\nlike NO_LIBPCRE1_JIT should be.\n\nWell, we have it *optionally* with autoconf, but as long as it's\noptional we don't save ourselves any time, and from packages I've seen\nin the wild most people who build git don't use it, so it wouldn't save\nthem any time either.\n"},{"id":"337306","messageId":"ee5185b1-7820-b2ac-1bde-da1c761fa594@jeffhostetler.com","threadId":"47671","inReplyTo":"CAG6xkCbe+pLwTCButZGdPucHoRCq-a8mWfifd6z2bzGZNseE9A@mail.gmail.com","subject":"Re: [RFC PATCH 0/1] Implement CMake build","fromName":"Jeff Hostetler","fromEmail":"git@jeffhostetler.com","sentAt":"2018-01-24T21:00:20Z","receivedAt":"2018-01-24T21:00:27Z","isPatch":true,"sender":{"key":"git@jeffhostetler.com","avatar":null},"body":"\n\nOn 1/24/2018 2:59 PM, Isaac Hier wrote:\n> Jeff, no worries, fair enough. I know https://github.com/grpc/grpc\n> uses a shared file to generate code for several build systems instead\n> of maintaining them individually. I plan on doing the work anyway just\n> because I have my own reasons to use CMake in Git (for packaging in\n> https://github.com/ruslo/hunter is my main motive here). Whether or\n> not it is maintained upstream is not a real concern for me at the\n> moment.\n[...]\n> I'll see how the Windows build currently works and if that makes\n> sense, maybe I'll try using that build generator here too.\n> \n> Thanks for the feedback,\n> \n> Isaac\n\nLook at the \"vcxproj:\" target in config.mak.uname (in the GfW repo).\n\nJeff\n"},{"id":"337310","messageId":"c5d21b22-e4cd-e338-c953-90a81981e23c@gmx.net","threadId":"47671","inReplyTo":"CAG6xkCZn6m2n0rDvpN6MmZcOr2hJBRCfhrppC37f-DUj3_JZsw@mail.gmail.com","subject":"Re: [RFC PATCH 0/1] Implement CMake build","fromName":"Stephan Beyer","fromEmail":"s-beyer@gmx.net","sentAt":"2018-01-24T21:15:41Z","receivedAt":"2018-01-24T21:15:53Z","isPatch":true,"sender":{"key":"s-beyer@gmx.net","avatar":"https://avatars.githubusercontent.com/u/143889?v=4"},"body":"Hi Isaac,\n\nOn 01/24/2018 02:45 PM, Isaac Hier wrote:\n> I realize this is a huge patch, but does anyone have feedback for the\n> general idea?\n\nThank you very much. I am *personally* interested in this due to several\nreasons (which are mostly that I am used to CMake and when I do\nsomething on the Git codebase, I always end up that its build system\nrecompiles everything ...which drives me crazy as hell. Using CMake, I\ncould simply use out-of-source builds and be happy).\n\nI am not sure if it should go into the main Git repo. I'd already be\nhappy if I could pull it from somewhere (github for example) and rebase\nit to use for my local branches.\n\n~Stephan\n"},{"id":"337311","messageId":"CAG6xkCbT1t1X71FhHvbsX_gzx2a0hpP5Hsg59g9PMMoGJy=9CQ@mail.gmail.com","threadId":"47671","inReplyTo":"ee5185b1-7820-b2ac-1bde-da1c761fa594@jeffhostetler.com","subject":"Re: [RFC PATCH 0/1] Implement CMake build","fromName":"Isaac Hier","fromEmail":"isaachier@gmail.com","sentAt":"2018-01-24T21:17:12Z","receivedAt":"2018-01-24T21:17:18Z","isPatch":true,"sender":{"key":"isaachier@gmail.com","avatar":null},"body":"CMake is very portable (see\nhttps://open.cdash.org/index.php?project=CMake for details). About the\nwhole autoconf history in Git, I came across this post by Linus while\nresearching if anyone had done something with CMake in the git project\nbefore:\n\n> NO! At least the Makefile is debuggable and understandable.\n>\n> If we need a better build system, I'd much rather use something\n> higher-level that can generate VC++ project files etc.\n>\n> In other words, I'd much rather see us using CMake or something like that,\n> which actually adds real value-add.\n>\n> (And no, I've never used cmake, so maybe it has horrors waiting for us\n> too, but autoconf is just worthless).\n>\n> Linus\n\nhttps://marc.info/?l=git&m=115032515024816&w=2\n\nOn Wed, Jan 24, 2018 at 4:00 PM, Jeff Hostetler <git@jeffhostetler.com> wrote:\n>\n>\n> On 1/24/2018 2:59 PM, Isaac Hier wrote:\n>>\n>> Jeff, no worries, fair enough. I know https://github.com/grpc/grpc\n>> uses a shared file to generate code for several build systems instead\n>> of maintaining them individually. I plan on doing the work anyway just\n>> because I have my own reasons to use CMake in Git (for packaging in\n>> https://github.com/ruslo/hunter is my main motive here). Whether or\n>> not it is maintained upstream is not a real concern for me at the\n>> moment.\n>\n> [...]\n>>\n>> I'll see how the Windows build currently works and if that makes\n>> sense, maybe I'll try using that build generator here too.\n>>\n>> Thanks for the feedback,\n>>\n>> Isaac\n>\n>\n> Look at the \"vcxproj:\" target in config.mak.uname (in the GfW repo).\n>\n> Jeff\n"},{"id":"337314","messageId":"CAG6xkCbtVYa_eqZj4m74jXo7yC8kS8kjWm-fALePmHaH5yY0qg@mail.gmail.com","threadId":"47671","inReplyTo":"c5d21b22-e4cd-e338-c953-90a81981e23c@gmx.net","subject":"Re: [RFC PATCH 0/1] Implement CMake build","fromName":"Isaac Hier","fromEmail":"isaachier@gmail.com","sentAt":"2018-01-24T21:19:57Z","receivedAt":"2018-01-24T21:20:04Z","isPatch":true,"sender":{"key":"isaachier@gmail.com","avatar":null},"body":"Thanks for your interest! This patch is based on the cmake-build\nbranch of https://github.com/isaachier/git, but the full history is on\nthe cmake branch (squashed it for easier readability). Hope that\nhelps.\n\nOn Wed, Jan 24, 2018 at 4:15 PM, Stephan Beyer <s-beyer@gmx.net> wrote:\n> Hi Isaac,\n>\n> On 01/24/2018 02:45 PM, Isaac Hier wrote:\n>> I realize this is a huge patch, but does anyone have feedback for the\n>> general idea?\n>\n> Thank you very much. I am *personally* interested in this due to several\n> reasons (which are mostly that I am used to CMake and when I do\n> something on the Git codebase, I always end up that its build system\n> recompiles everything ...which drives me crazy as hell. Using CMake, I\n> could simply use out-of-source builds and be happy).\n>\n> I am not sure if it should go into the main Git repo. I'd already be\n> happy if I could pull it from somewhere (github for example) and rebase\n> it to use for my local branches.\n>\n> ~Stephan\n"},{"id":"337324","messageId":"e3d1e1f4-9927-47eb-7662-2c6918555058@gmx.net","threadId":"47671","inReplyTo":"CAG6xkCbtVYa_eqZj4m74jXo7yC8kS8kjWm-fALePmHaH5yY0qg@mail.gmail.com","subject":"Re: [RFC PATCH 0/1] Implement CMake build","fromName":"Stephan Beyer","fromEmail":"s-beyer@gmx.net","sentAt":"2018-01-24T22:02:59Z","receivedAt":"2018-01-24T22:03:09Z","isPatch":true,"sender":{"key":"s-beyer@gmx.net","avatar":"https://avatars.githubusercontent.com/u/143889?v=4"},"body":"On 01/24/2018 10:19 PM, Isaac Hier wrote:\n> Thanks for your interest! This patch is based on the cmake-build\n> branch of https://github.com/isaachier/git, but the full history is on\n> the cmake branch (squashed it for easier readability). Hope that\n> helps.\n\nThanks. I use the cmake branch because I prefer \"real\" history over one\nhuge commit.\n\nAnd I already love it. Thanks for all the work!\n\nFrom a first short glance, I wonder if you should mark a lot more\noptions as advanced options, like the paths (e.g., SHELL_PATH,\nLESS_PATH, GETTEXT_MSGFMT_EXECUTABLE, etc.) and probably also things\nlike GIT_USER_AGENT. If you use a configuration tool like ccmake, you\nsee a lot of options and many of them are not relevant to the average user.\n\nI also think some variables have weird names, for example, POLL, PREAD,\nMMAP should be USE_POLL, USE_PREAD, USE_MMAP, respectively... or even\nUSE_*_SYSCALL, I don't know.\n\nBy the way, regarding up-to-dateness, you are missing these recent\nchanges that have been merged to master:\n\n  edb6a17c36 Makefile: NO_OPENSSL=1 should no longer imply BLK_SHA1=1\n  3f824e91c8 t/Makefile: introduce TEST_SHELL_PATH\n\n(which is not surprising)\n\n~Stephan\n"},{"id":"337354","messageId":"CAG6xkCZK+Vda=Mtpy665tiGZ_FpXzUaz__w+FFpfE+zZioRX2Q@mail.gmail.com","threadId":"47671","inReplyTo":"e3d1e1f4-9927-47eb-7662-2c6918555058@gmx.net","subject":"Re: [RFC PATCH 0/1] Implement CMake build","fromName":"Isaac Hier","fromEmail":"isaachier@gmail.com","sentAt":"2018-01-25T02:16:44Z","receivedAt":"2018-01-25T02:16:53Z","isPatch":true,"sender":{"key":"isaachier@gmail.com","avatar":null},"body":"Stephan, I totally agree about the advanced options. At first, I left\nthem as visible options seeing as the Makefile does not comment which\nare advanced and which are basic.\n\nIn terms of the up-to-dateness, I find it easier to \"fast-forward\" all\nthe changes at once without tangling myself in a load of periodic\nupdates.\n\nOn Wed, Jan 24, 2018 at 5:02 PM, Stephan Beyer <s-beyer@gmx.net> wrote:\n> On 01/24/2018 10:19 PM, Isaac Hier wrote:\n>> Thanks for your interest! This patch is based on the cmake-build\n>> branch of https://github.com/isaachier/git, but the full history is on\n>> the cmake branch (squashed it for easier readability). Hope that\n>> helps.\n>\n> Thanks. I use the cmake branch because I prefer \"real\" history over one\n> huge commit.\n>\n> And I already love it. Thanks for all the work!\n>\n> From a first short glance, I wonder if you should mark a lot more\n> options as advanced options, like the paths (e.g., SHELL_PATH,\n> LESS_PATH, GETTEXT_MSGFMT_EXECUTABLE, etc.) and probably also things\n> like GIT_USER_AGENT. If you use a configuration tool like ccmake, you\n> see a lot of options and many of them are not relevant to the average user.\n>\n> I also think some variables have weird names, for example, POLL, PREAD,\n> MMAP should be USE_POLL, USE_PREAD, USE_MMAP, respectively... or even\n> USE_*_SYSCALL, I don't know.\n>\n> By the way, regarding up-to-dateness, you are missing these recent\n> changes that have been merged to master:\n>\n>   edb6a17c36 Makefile: NO_OPENSSL=1 should no longer imply BLK_SHA1=1\n>   3f824e91c8 t/Makefile: introduce TEST_SHELL_PATH\n>\n> (which is not surprising)\n>\n> ~Stephan\n"},{"id":"337449","messageId":"CAG6xkCa_nKtzhJJq=v7gazWe+8FnN3mz1vDftzZw2WUFqJ1bzw@mail.gmail.com","threadId":"47671","inReplyTo":"ee5185b1-7820-b2ac-1bde-da1c761fa594@jeffhostetler.com","subject":"Re: [RFC PATCH 0/1] Implement CMake build","fromName":"Isaac Hier","fromEmail":"isaachier@gmail.com","sentAt":"2018-01-26T00:21:24Z","receivedAt":"2018-01-26T00:21:32Z","isPatch":true,"sender":{"key":"isaachier@gmail.com","avatar":null},"body":"Hi Jeff,\n\nI have been looking at the build generator, which looks promising, but\nI have one concern. Assuming I can generate a CMakeLists.txt that\nappropriately updates the library sources, etc. how do you suggest I\nhandle new portability macros? For example, assume someone adds a\nmacro HAVE_X to indicate the availability of some platform-specific\nfunction x. In the current Makefile, a comment would be added to the\ntop indicating when HAVE_X or NO_X should be set, and that option\nwould toggle the HAVE_X C macro. But CMake can test for the\navailability of x, which is one of the main motives for adding a CMake\nbuild. The current build generator uses the output of make, so all it\nwould know is whether or not HAVE_X is defined on the platform that\nran the Makefile, but not the entire list of platform that git\nsupports.\n\nBottom line: should I add the portability tests as they are now,\nwithout accounting for future portability macros? One good alternative\nmight be to suggest the authors of new portability macros include a\nsmall sample C program to test it. That would allow me to easily patch\nthe CMake tests whenever that came up. In a best case scenario, a\npractice could be established to write the test in a specific\ndirectory with a certain name so that I could automatically update the\nCMake tests from the build generator.\n\nThanks for the help,\n\nIsaac\n\nOn Wed, Jan 24, 2018 at 4:00 PM, Jeff Hostetler <git@jeffhostetler.com> wrote:\n>\n>\n> On 1/24/2018 2:59 PM, Isaac Hier wrote:\n>>\n>> Jeff, no worries, fair enough. I know https://github.com/grpc/grpc\n>> uses a shared file to generate code for several build systems instead\n>> of maintaining them individually. I plan on doing the work anyway just\n>> because I have my own reasons to use CMake in Git (for packaging in\n>> https://github.com/ruslo/hunter is my main motive here). Whether or\n>> not it is maintained upstream is not a real concern for me at the\n>> moment.\n>\n> [...]\n>>\n>> I'll see how the Windows build currently works and if that makes\n>> sense, maybe I'll try using that build generator here too.\n>>\n>> Thanks for the feedback,\n>>\n>> Isaac\n>\n>\n> Look at the \"vcxproj:\" target in config.mak.uname (in the GfW repo).\n>\n> Jeff\n"},{"id":"337489","messageId":"c134350c-5f73-9194-9815-a7f61ed30d03@jeffhostetler.com","threadId":"47671","inReplyTo":"CAG6xkCa_nKtzhJJq=v7gazWe+8FnN3mz1vDftzZw2WUFqJ1bzw@mail.gmail.com","subject":"Re: [RFC PATCH 0/1] Implement CMake build","fromName":"Jeff Hostetler","fromEmail":"git@jeffhostetler.com","sentAt":"2018-01-26T17:34:51Z","receivedAt":"2018-01-26T17:34:59Z","isPatch":true,"sender":{"key":"git@jeffhostetler.com","avatar":null},"body":"\n\nOn 1/25/2018 7:21 PM, Isaac Hier wrote:\n> Hi Jeff,\n> \n> I have been looking at the build generator, which looks promising, but\n> I have one concern. Assuming I can generate a CMakeLists.txt that\n> appropriately updates the library sources, etc. how do you suggest I\n> handle new portability macros? For example, assume someone adds a\n> macro HAVE_X to indicate the availability of some platform-specific\n> function x. In the current Makefile, a comment would be added to the\n> top indicating when HAVE_X or NO_X should be set, and that option\n> would toggle the HAVE_X C macro. But CMake can test for the\n> availability of x, which is one of the main motives for adding a CMake\n> build. The current build generator uses the output of make, so all it\n> would know is whether or not HAVE_X is defined on the platform that\n> ran the Makefile, but not the entire list of platform that git\n> supports.\n> \n> Bottom line: should I add the portability tests as they are now,\n> without accounting for future portability macros? One good alternative\n> might be to suggest the authors of new portability macros include a\n> small sample C program to test it. That would allow me to easily patch\n> the CMake tests whenever that came up. In a best case scenario, a\n> practice could be established to write the test in a specific\n> directory with a certain name so that I could automatically update the\n> CMake tests from the build generator.\n> \n> Thanks for the help,\n> \n> Isaac\n\nIt's been years since I've used cmake as anything other than\na casual (downstream) consumer, so I'm not sure I can answer\nyour questions.\n\nThe vcxproj target we have is a bit of a hack to automatically\ncapture the set of source files and target libraries and executables.\nWe don't try to capture the spirit of all of the HAVE_ and NO_ flags\nwhen we build the *.vcxproj files.  And we make some assumptions in\nthe generation template for the usual VC/VS settings.  But then\nWindows is a single target and we don't have to worry about some\nthings (like whether or not qsort is present).\n\nI don't want to discourage you from attempting this.  (And I realize\nthat my initial response might have given that impression -- I mainly\nwanted to say that we don't currently have a problem on Windows with\nthe current Makefile situation.)\n\nA full cmake system would let us simplify some things, but it also\ncomplicates some things.  So we might be trading one set of problems\nfor another.  For example, the libgit2 project uses cmake.  Not to\npick on them, but when I look at it, I see a lot of the same issues\n(but perhaps with better syntax than the makefile).\n\n     https://github.com/libgit2/libgit2/blob/master/CMakeLists.txt\n\nAs to your portability test questions, I'm afraid I don't know.\nSorry,\nJeff\n\n\n"},{"id":"339713","messageId":"CAHd499A+TT4zWPvW84B8XpmCdvoJCnSOZxY98MKZUO3h7cwo0g@mail.gmail.com","threadId":"47671","inReplyTo":"CAG6xkCa_nKtzhJJq=v7gazWe+8FnN3mz1vDftzZw2WUFqJ1bzw@mail.gmail.com","subject":"Re: [RFC PATCH 0/1] Implement CMake build","fromName":"Robert Dailey","fromEmail":"rcdailey.lists@gmail.com","sentAt":"2018-02-20T16:28:54Z","receivedAt":"2018-02-20T16:29:01Z","isPatch":true,"sender":{"key":"rcdailey.lists@gmail.com","avatar":null},"body":"On Thu, Jan 25, 2018 at 6:21 PM, Isaac Hier <isaachier@gmail.com> wrote:\n> Hi Jeff,\n>\n> I have been looking at the build generator, which looks promising, but\n> I have one concern. Assuming I can generate a CMakeLists.txt that\n> appropriately updates the library sources, etc. how do you suggest I\n> handle new portability macros? For example, assume someone adds a\n> macro HAVE_X to indicate the availability of some platform-specific\n> function x. In the current Makefile, a comment would be added to the\n> top indicating when HAVE_X or NO_X should be set, and that option\n> would toggle the HAVE_X C macro. But CMake can test for the\n> availability of x, which is one of the main motives for adding a CMake\n> build. The current build generator uses the output of make, so all it\n> would know is whether or not HAVE_X is defined on the platform that\n> ran the Makefile, but not the entire list of platform that git\n> supports.\n>\n> Bottom line: should I add the portability tests as they are now,\n> without accounting for future portability macros? One good alternative\n> might be to suggest the authors of new portability macros include a\n> small sample C program to test it. That would allow me to easily patch\n> the CMake tests whenever that came up. In a best case scenario, a\n> practice could be established to write the test in a specific\n> directory with a certain name so that I could automatically update the\n> CMake tests from the build generator.\n\nIsaac,\n\nI'm very happy that you have started support for CMake. I have a lot\nof experience with it. I'd love to help contribute. Do you have a fork\non github where this code is? I'd have to figure out how to apply a\npatch from email, I haven't done it before. I think the goal should be\nto replace the existing build system (this can be a transition that\nhappens slowly). I've been in situations where multiple build systems\nare supported in parallel, worst case because of split personal\npreferences on a project. That is more counterproductive than asking\nthe team to just compromise and take the initial hit on learning\ncurve. Ultimately that's up to the Git community, but that would be my\nrecommendation. But I think making CMake as complete as possible will\nhelp build that confidence and trust. I can completely understand the\ncomplexities and concerns they have.\n"},{"id":"340059","messageId":"CAG6xkCahiTedAiB9m8yjMN=QD_KLqc_bKwT9nGt=y2Jd3SsSBw@mail.gmail.com","threadId":"47671","inReplyTo":"CAHd499A+TT4zWPvW84B8XpmCdvoJCnSOZxY98MKZUO3h7cwo0g@mail.gmail.com","subject":"Re: [RFC PATCH 0/1] Implement CMake build","fromName":"Isaac Hier","fromEmail":"isaachier@gmail.com","sentAt":"2018-02-23T18:48:21Z","receivedAt":"2018-02-23T19:44:24Z","isPatch":true,"sender":{"key":"isaachier@gmail.com","avatar":null},"body":"Yes I think I mentioned earlier that I have it hosted at\nhttps://github.com/isaachier/git. I have been busy with a few things\nso have not continued much since I started this conversation, but it\ncovers a large part of the Makefile if not all the significant\nportions.\n\nOn Tue, Feb 20, 2018 at 11:28 AM, Robert Dailey\n<rcdailey.lists@gmail.com> wrote:\n> On Thu, Jan 25, 2018 at 6:21 PM, Isaac Hier <isaachier@gmail.com> wrote:\n>> Hi Jeff,\n>>\n>> I have been looking at the build generator, which looks promising, but\n>> I have one concern. Assuming I can generate a CMakeLists.txt that\n>> appropriately updates the library sources, etc. how do you suggest I\n>> handle new portability macros? For example, assume someone adds a\n>> macro HAVE_X to indicate the availability of some platform-specific\n>> function x. In the current Makefile, a comment would be added to the\n>> top indicating when HAVE_X or NO_X should be set, and that option\n>> would toggle the HAVE_X C macro. But CMake can test for the\n>> availability of x, which is one of the main motives for adding a CMake\n>> build. The current build generator uses the output of make, so all it\n>> would know is whether or not HAVE_X is defined on the platform that\n>> ran the Makefile, but not the entire list of platform that git\n>> supports.\n>>\n>> Bottom line: should I add the portability tests as they are now,\n>> without accounting for future portability macros? One good alternative\n>> might be to suggest the authors of new portability macros include a\n>> small sample C program to test it. That would allow me to easily patch\n>> the CMake tests whenever that came up. In a best case scenario, a\n>> practice could be established to write the test in a specific\n>> directory with a certain name so that I could automatically update the\n>> CMake tests from the build generator.\n>\n> Isaac,\n>\n> I'm very happy that you have started support for CMake. I have a lot\n> of experience with it. I'd love to help contribute. Do you have a fork\n> on github where this code is? I'd have to figure out how to apply a\n> patch from email, I haven't done it before. I think the goal should be\n> to replace the existing build system (this can be a transition that\n> happens slowly). I've been in situations where multiple build systems\n> are supported in parallel, worst case because of split personal\n> preferences on a project. That is more counterproductive than asking\n> the team to just compromise and take the initial hit on learning\n> curve. Ultimately that's up to the Git community, but that would be my\n> recommendation. But I think making CMake as complete as possible will\n> help build that confidence and trust. I can completely understand the\n> complexities and concerns they have.\n"}]}