Repository navigation
COMP: Build elastix_lib and transformix_lib as STATIC libraries - #1506
Merged
N-Dekker merged 1 commit intoDec 3, 2026
Merged
Conversation
`elastix_lib` and `transformix_lib` were the only library targets of elastix whose type was still determined by `BUILD_SHARED_LIBS`. While elastix rejects `BUILD_SHARED_LIBS` at the start of its top-level CMakeLists.txt, the variable may still be set afterwards, by a package found by `find_package(ITK)`. For example, when ITK is built with `ITK_USE_SYSTEM_VXL` against a shared VXL, the VXLConfig.cmake of that VXL has `set(BUILD_SHARED_LIBS "ON")`. The two libraries were then built as shared libraries, while all other elastix libraries were static. Follow-up to pull request SuperElastix#184 commit bb902f7 "COMP: Explicitly disable BUILD_SHARED_LIBS"
N-Dekker
approved these changes
Dec 3, 2026
| # The library type (STATIC or SHARED) is determined by the parameter | ||
| # BUILD_SHARED_LIBS. | ||
| add_library(elastix_lib | ||
| add_library(elastix_lib STATIC |
Member
There was a problem hiding this comment.
@Voggo Thanks Niels! Looks fine to me!
@mstaring @stefanklein This pull request makes it clearer that we only build static elastix libs, no elastix DLL's. I think it's OK to merge, when it has passed the CI.
We can of course reconsider this adjustment if we might ever need to have elastix DLL's anyway.
Kind regards, Niels 2 😃
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
elastix_libandtransformix_libare the only library targets of elastix whose type is still determined byBUILD_SHARED_LIBS. elastix rejectsBUILD_SHARED_LIBSat the start of its top-levelCMakeLists.txt(pull request #184), but the variable can still be set afterwards, by a package thatfind_package(ITK)finds.Example: an ITK built with
ITK_USE_SYSTEM_VXLagainst a shared VXL. TheVXLConfig.cmakeof that VXL hasset(BUILD_SHARED_LIBS "ON"). The elastix build then silently produceslibelastix-5.3.1.soandlibtransformix-5.3.1.so, next to static libraries for everything else.This pull request adds
STATICto the twoadd_librarycalls, as all other elastix libraries have already (elxCore,elxCommon, the components), and removes the comment saying that their type is determined byBUILD_SHARED_LIBS.Checked on Linux, GCC 13.3, against such an ITK (5.4.3): before, the two
.sofiles; after,libelastix-5.3.1.aandlibtransformix-5.3.1.a, and CommonGTest and ElastixLibGTest build and give the same results.Related: #184, #283.
🤖 Generated with Claude Code