Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: Amend crc32c static library #171

Merged
merged 1 commit into from
May 1, 2024
Merged

Conversation

hebasto
Copy link
Owner

@hebasto hebasto commented Apr 26, 2024

Avoid using source-specific compile options. They are hard to reason about and error-prone when combining with target-specific compile options.

The resulted build logic effectively mirrors the master branch's one.

Required for #157.

@hebasto hebasto added the blocker Required for other steps label Apr 27, 2024
Avoid using source-specific compile options. They hard to reason about
and error-prone when combining with target-specific compile options.

The resulted build logic effectively mirrors the master branch's one.
target_sources(crc32c PRIVATE ${PROJECT_SOURCE_DIR}/src/crc32c/src/crc32c_sse42.cc)
set_property(SOURCE ${PROJECT_SOURCE_DIR}/src/crc32c/src/crc32c_sse42.cc
APPEND PROPERTY COMPILE_OPTIONS ${SSE42_CXXFLAGS}
add_library(crc32c_sse42 STATIC EXCLUDE_FROM_ALL
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't these be OBJECT libraries since the static libs themselves are never useful?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it could. But CMake's developers recommend to use STATIC libraries if there is no compelling reasons for OBJECT ones. For example, from Professional CMake: A Practical Guide 18th Edition

Prefer defining static libraries over object libraries. Static libraries are simpler, have more
complete and robust support from earlier CMake versions and they are well understood by most
developers. Object libraries have their uses, but they are also less flexible than static libraries.

hebasto added a commit that referenced this pull request May 1, 2024
5ca0799 fixup! cmake: Build `bitcoin_crypto` library (Hennadii Stepanov)

Pull request description:

  Avoid using source-specific compile options. They hard to reason about and error-prone when combining with target-specific compile options.

  The resulted build logic effectively mirrors the master branch's one.

  Required for #157.

  Similar to #171.

ACKs for top commit:
  TheCharlatan:
    ACK 5ca0799

Tree-SHA512: 8f55c86a3ad900c8de1789a97c936e39362d9995d75d2f9ca2d0f65f5863816795623d8ec1f2cc5f4468e27d934ce99150574cf766a7d6dd1da68546f13216fb
Copy link

@TheCharlatan TheCharlatan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 43fbeac

@hebasto hebasto merged commit 86bbdca into cmake-staging May 1, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker Required for other steps
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants