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.
This pull request is ready to be merged.
Feature or improvement description
This PR changes the CMakeLists.txt files in each module so that the module libraries are built as STATIC even if CMake is configured with
-DBUILD_SHARED_LIBS=ON
. Interface libraries (C-Bindings) andopenfastlib
are always built as shared libraries so this change will not affect downstream users. This option is part of CMake: BUILD_SHARED_LIBSImpacted areas of the software
CMakeLists.txt files of all modules
Additional supporting information
This change arose from a problem installing WEIS which built OpenFAST with
-DBUILD_SHARED_LIBS=ON
. At one point, the only way to buildopenfastlib
as a shared library was to set-DBUILD_SHARED_LIBS=ON
. This library is currently always built as shared but many users still setBUILD_SHARED_LIBS=ON
which causes all module libraries to be created as shared libraries so they are dynamically loaded at run time. This commit changes the CMakeLists.txt files to build all module libs asSTATIC
regardless of howBUILD_SHARED_LIBS
is set. As a result, all module libraries will be statically linked intoopenfast
,openfastlib
andFAST.Farm
which should improve performance and reduce complexity. This also prevents a problem with building the Simulink MEX file which wouldn't work ifBUILD_SHARED_LIBS=ON
.