doc: Improve cmake instructions in README #1641

pull fjahr wants to merge 1 commits into bitcoin-core:master from fjahr:cmake-readme changing 1 files +13 −14
  1. fjahr commented at 9:45 PM on November 26, 2024: contributor

    Minor improvement suggestion for the readme. I find this alternative way of using cmake a bit more comfortable because I don't like to change the directory.

    It's just a suggestion based on personal preference, if this is too minor of an improvement feel free to close.

  2. fjahr force-pushed on Nov 26, 2024
  3. real-or-random added the label user-documentation on Nov 27, 2024
  4. real-or-random added the label build on Nov 27, 2024
  5. real-or-random commented at 8:13 AM on November 27, 2024: contributor

    I happen to find this a tiny bit more comfortable, too, but IIRC we had discussed this (I can't find the discussion) and @hebasto argued that the tutorial cds into the build directory. I also think that mkdir build && cd build is a bit more self-documentary to people not familiar with CMake because it makes clear that build is a directory and not some CMake command or something.

    No strong opinion from my side, but I think there are good reasons for what we have currently.

  6. fjahr commented at 12:32 AM on November 28, 2024: contributor

    @real-or-random alright, thanks for the info, closing it for now

  7. fjahr closed this on Nov 28, 2024

  8. hebasto commented at 1:14 PM on November 28, 2024: member

    FWIW, while working on the CMake staging branch for Bitcoin Core, the rough consensus has been reached not to suggest using cd in the build docs (see https://github.com/bitcoin/bitcoin/blob/master/doc/build-*.md).

  9. fjahr commented at 2:40 PM on December 3, 2024: contributor

    Ok, reopening since @real-or-random seemed in favor and I take from @hebasto 's comment that the argument for cd-ing seems not so relevant anymore and this would align the instructions here with bitcoin core.

  10. fjahr reopened this on Dec 3, 2024

  11. in README.md:87 in b339fe45ab outdated
      87 | +    $ cmake -B build
      88 | +    $ cmake --build build
      89 | +    $ ctest --test-dir build  # run the test suite
      90 | +    $ sudo cmake --install build  # optional
      91 |  
      92 |  To compile optional modules (such as Schnorr signatures), you need to run `cmake` with additional flags (such as `-DSECP256K1_ENABLE_MODULE_SCHNORRSIG=ON`). Run `cmake .. -LH` to see the full list of available flags.
    


    hebasto commented at 3:06 PM on December 3, 2024:

    This has to be adjusted accordingly:

    To compile optional modules (such as Schnorr signatures), you need to run `cmake` with additional flags (such as `-DSECP256K1_ENABLE_MODULE_SCHNORRSIG=ON`). Run `cmake -B build -LH` to see the full list of available flags.
    

    Or even:

    To compile optional modules (such as Schnorr signatures), you need to run `cmake` with additional flags (such as `-DSECP256K1_ENABLE_MODULE_SCHNORRSIG=ON`). Run `cmake -B build -LH` or `ccmake -B build` to see the full list of available flags.
    

    fjahr commented at 11:10 PM on December 3, 2024:

    done

  12. in README.md:94 in b339fe45ab outdated
      90 | @@ -92,11 +91,11 @@ To compile optional modules (such as Schnorr signatures), you need to run `cmake
      91 |  To alleviate issues with cross compiling, preconfigured toolchain files are available in the `cmake` directory.
      92 |  For example, to cross compile for Windows:
      93 |  
      94 | -    $ cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/x86_64-w64-mingw32.toolchain.cmake
      95 | +    $ cmake --build build -DCMAKE_TOOLCHAIN_FILE=../cmake/x86_64-w64-mingw32.toolchain.cmake
    


    hebasto commented at 3:06 PM on December 3, 2024:
        $ cmake --build build -DCMAKE_TOOLCHAIN_FILE=cmake/x86_64-w64-mingw32.toolchain.cmake
    

    fjahr commented at 11:10 PM on December 3, 2024:

    done

  13. fjahr force-pushed on Dec 3, 2024
  14. fjahr commented at 11:11 PM on December 3, 2024: contributor

    Fixed comments from @hebasto, thanks!

  15. real-or-random approved
  16. real-or-random commented at 9:20 AM on December 4, 2024: contributor

    utACK 93363fa0743b11c7daf04db457b0dba3cec07af2

  17. in README.md:94 in 93363fa074 outdated
      96 |  
      97 |  To alleviate issues with cross compiling, preconfigured toolchain files are available in the `cmake` directory.
      98 |  For example, to cross compile for Windows:
      99 |  
     100 | -    $ cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/x86_64-w64-mingw32.toolchain.cmake
     101 | +    $ cmake --build build -DCMAKE_TOOLCHAIN_FILE=cmake/x86_64-w64-mingw32.toolchain.cmake
    


    hebasto commented at 5:40 PM on December 4, 2024:

    My apologies for the typo:

        $ cmake -B build -DCMAKE_TOOLCHAIN_FILE=cmake/x86_64-w64-mingw32.toolchain.cmake
    

    It was my fault.


    fjahr commented at 9:38 PM on December 5, 2024:

    fixed

  18. in README.md:98 in 93363fa074 outdated
     101 | +    $ cmake --build build -DCMAKE_TOOLCHAIN_FILE=cmake/x86_64-w64-mingw32.toolchain.cmake
     102 |  
     103 |  To cross compile for Android with [NDK](https://developer.android.com/ndk/guides/cmake) (using NDK's toolchain file, and assuming the `ANDROID_NDK_ROOT` environment variable has been set):
     104 |  
     105 | -    $ cmake .. -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake" -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=28
     106 | +    $ cmake --build build -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake" -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=28
    


    hebasto commented at 5:40 PM on December 4, 2024:

    Same here:

        $ cmake -B build -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake" -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=28
    

    fjahr commented at 9:38 PM on December 5, 2024:

    fixed

  19. hebasto commented at 5:41 PM on December 4, 2024: member

    To unify all examples, -S . can be dropped from the example for Windows.

  20. in README.md:85 in 93363fa074 outdated
      85 | -    $ ctest  # run the test suite
      86 | -    $ sudo cmake --install .  # optional
      87 | +    $ cmake -B build
      88 | +    $ cmake --build build
      89 | +    $ ctest --test-dir build  # run the test suite
      90 | +    $ sudo cmake --install build  # optional
    


    real-or-random commented at 12:37 PM on December 5, 2024:

    If you touch this anyway, perhaps it could be made clear that build is a directory here (and it can't hurt to explain the steps in more detail).

        $ cmake -B build  # Generate a build system in subdirectory "build"
        $ cmake --build build  # Run the actual build process
        $ ctest --test-dir build  # Run the test suite
        $ sudo cmake --install build  # Install the library into the system (optional)
    

    fjahr commented at 9:39 PM on December 5, 2024:

    Sounds good, taken as suggested!

  21. fjahr force-pushed on Dec 5, 2024
  22. fjahr commented at 9:39 PM on December 5, 2024: contributor

    Thanks, took the suggested changes and removed the -S . from the windows example too.

  23. real-or-random commented at 10:42 AM on December 6, 2024: contributor

    LGTM but sorry, a last nit: Perhaps then the comments for the autotools build should also be improved for consistency.

        $ ./autogen.sh       # Generate a ./configure script
        $ ./configure        # Generate a build system
        $ make               # Run the actual build process
        $ make check         # Run the test suite
        $ sudo make install  # Install the library into the system (optional)
    

    And indenting to the same column is more readable, and then should also be done for the CMake instructions for consistency.

  24. doc: Improve cmake instructions in README 2ac9f558c4
  25. fjahr force-pushed on Dec 6, 2024
  26. fjahr commented at 6:46 PM on December 6, 2024: contributor

    @real-or-random no worries, applied all the suggested changes

  27. hebasto approved
  28. hebasto commented at 6:56 PM on December 6, 2024: member

    ACK 2ac9f558c43b5ef11f0d6e1088a8295a6d162659.

  29. real-or-random approved
  30. real-or-random commented at 8:22 AM on December 9, 2024: contributor

    utACK 2ac9f558c43b5ef11f0d6e1088a8295a6d162659

  31. real-or-random merged this on Dec 9, 2024
  32. real-or-random closed this on Dec 9, 2024


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-22 18:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me