Skip to content

Overhaul CMake#63

Merged
zkat merged 6 commits intomainfrom
sy/cmake-overhaul
Aug 20, 2025
Merged

Overhaul CMake#63
zkat merged 6 commits intomainfrom
sy/cmake-overhaul

Conversation

@TartanLlama
Copy link
Copy Markdown
Collaborator

Improves the modularity and utility of the build system

  • Avoids setting global CMake variables, opting for target-based functions
  • Enables including as a subproject from existing CMake projects
  • Adds alias targets to protect against typos on linking
  • Separates public headers out from private headers
  • Changes the include style of public headers to avoid relative paths
  • Simplifies WASI SDK inclusion
  • Replaces reliance on dist output folder with install targets
  • Adds config and version CMake files to support find_package scenarios
  • Changes quickstart project to use find_package rather than manual linking
  • Enables adding a vcpkg port for the SDK in the future

@TartanLlama
Copy link
Copy Markdown
Collaborator Author

Fixes #58

@TartanLlama TartanLlama requested a review from zkat August 18, 2025 16:14
@zkat
Copy link
Copy Markdown
Member

zkat commented Aug 18, 2025

looks like you've got some conflicts to fix here now

Comment thread CMakeLists.txt
INTERPROCEDURAL_OPTIMIZATION ${LTO_SUPPORTED})
target_link_options(fastly-thin PRIVATE ${FASTLY_LDFLAGS})

target_compile_options(fastly-thin PRIVATE -Wall -Wextra -Werror ${FASTLY_CXXFLAGS})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

oh. I guess we're not using MSVC at all since it's always clang huh

Comment thread CMakeLists.txt
configure_file(${f} ${DIST_DIR}/fastly/${fr} COPYONLY)
list(APPEND incls "#include \"${fr}\"\n")
file(RELATIVE_PATH fr "${CMAKE_CURRENT_SOURCE_DIR}/include" ${f})
list(APPEND incls "#include <${fr}>\n")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I thought <foo> was only for "system" files?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I tend to use the rule of quotes for relative includes, angle brackets for absolute includes. Public headers are always absolute, cause it avoids differences between the in-build tree and the installed tree. In this particular case, it avoids the need to copy expected.h into the same place as the other public headers when building. See also Core Guideline SF.12

@zkat zkat added the technical improvement Non-user-visible technical improvement label Aug 19, 2025
@zkat zkat linked an issue Aug 20, 2025 that may be closed by this pull request
@zkat zkat merged commit 5f95e36 into main Aug 20, 2025
8 checks passed
@zkat zkat deleted the sy/cmake-overhaul branch August 20, 2025 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

technical improvement Non-user-visible technical improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CMake cleanup

2 participants