add SIMDJSON_INSTALL option by safesintesi · Pull Request #2649 · simdjson/simdjson · GitHub
Skip to content

add SIMDJSON_INSTALL option#2649

Merged
lemire merged 1 commit intosimdjson:masterfrom
safesintesi:master
Mar 29, 2026
Merged

add SIMDJSON_INSTALL option#2649
lemire merged 1 commit intosimdjson:masterfrom
safesintesi:master

Conversation

@safesintesi
Copy link
Copy Markdown
Contributor

Added a SIMDJSON_INSTALL cmake option to avoid installing the targets by default if the repo is imported with add_subdirectory or cmake's fetchcontet.

Description
Before all targets from simdjson would be installed together with the package of the calling repo (including static libraries and cmake files). With this it is off by default but can be turned on. This is the same approach used by fmt.
In case the repo is imported the value of the option is based on wether the libraries are static or not (it doesn't make sanse to install a static lib). Also this installed files the would confilct with packages imorting the repo the same way.

Type of change

  • Bug fix
  • Optimization
  • New feature
  • Refactor / cleanup
  • Documentation / tests
  • Other (please describe):

How to verify / test

  • Use your example repo: git clone https://github.com/simdjson/cmake_demo_single_file.git
  • add cpack snippet at the end
set(CPACK_PACKAGE_DESCRIPTION "${CMAKE_PROJECT_DESCRIPTION}")
set(CPACK_PACKAGE_CONTACT "Human Developer <humandev@example.com>")
set(CPACK_PACKAGE_VENDOR "idk_bruh")
set(CPACK_GENERATOR "DEB")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
include(CPack)
  • call cpack to get a deb

Before:

drwxr-xr-x root/root         0 2026-03-26 17:47 ./usr/
drwxr-xr-x root/root         0 2026-03-26 17:47 ./usr/include/
-rw-r--r-- root/root   1185188 2026-03-26 17:43 ./usr/include/simdjson.h
drwxr-xr-x root/root         0 2026-03-26 17:47 ./usr/lib/
drwxr-xr-x root/root         0 2026-03-26 17:47 ./usr/lib/cmake/
drwxr-xr-x root/root         0 2026-03-26 17:47 ./usr/lib/cmake/simdjson/
-rw-r--r-- root/root      3791 2026-03-26 17:44 ./usr/lib/cmake/simdjson/simdjson-config-version.cmake
-rw-r--r-- root/root       138 2026-03-26 17:44 ./usr/lib/cmake/simdjson/simdjson-config.cmake
-rw-r--r-- root/root       890 2026-03-26 17:44 ./usr/lib/cmake/simdjson/simdjsonTargets-relwithdebinfo.cmake
-rw-r--r-- root/root      3558 2026-03-26 17:44 ./usr/lib/cmake/simdjson/simdjsonTargets.cmake
-rw-r--r-- root/root   5006542 2026-03-26 17:45 ./usr/lib/libsimdjson.a

After:

drwxr-xr-x root/root         0 2026-03-26 18:01 ./usr/

Checklist before submitting

  • I added/updated tests covering my change (if applicable)
  • Code builds locally and passes my check
  • Documentation / README updated if needed
  • Commits are atomic and messages are clear
  • I linked the related issue (if applicable)

@lemire lemire requested a review from Copilot March 26, 2026 18:48
@lemire
Copy link
Copy Markdown
Member

lemire commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a SIMDJSON_INSTALL CMake option to control whether simdjson defines install rules, primarily to prevent unintended installs when simdjson is consumed via add_subdirectory() / FetchContent.

Changes:

  • Introduces SIMDJSON_INSTALL and gates all install/package export rules behind it.
  • Sets different defaults for SIMDJSON_INSTALL depending on whether simdjson is the top-level project.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CMakeLists.txt
Comment thread CMakeLists.txt
@lemire lemire merged commit 2165745 into simdjson:master Mar 29, 2026
89 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants