diff options
author | Andrew Kaster <akaster@serenityos.org> | 2021-08-01 04:37:28 -0600 |
---|---|---|
committer | Gunnar Beutner <gunnar@beutner.name> | 2021-08-02 09:05:28 +0200 |
commit | 40b0767d88b437e3cfcf2279ed57d979cac8b92d (patch) | |
tree | c6cc9af6c05939d3f278a7c87e2ff32831184d5e /Meta/Lagom/CMakeLists.txt | |
parent | 845d403b8c175ff99793239404ca8657d95da104 (diff) | |
download | serenity-40b0767d88b437e3cfcf2279ed57d979cac8b92d.zip |
Meta: Add BUILD_SHARED_LIBS option for Lagom builds
This standard CMake option controls whether add_library() calls will
use STATIC or SHARED by default. The flag is set to on by default
since that's what we want for normal CI jobs and local builds and the
test262 runner, but disabled for oss-fuzz builds.
This should finally fix the oss-fuzz build after it was broken in #9017
oss-fuzz un-breakage was verified by running the following commands in
the oss-fuzz repo:
python infra/helper.py build_image serenity
python infra/helper.py build_fuzzers --sanitizer address --engine afl \
--architecture x86_64 serenity /path/to/local/checkout/Meta/Lagom
python infra/helper.py check_build --sanitizer address --engine afl \
--architecture x86_64 serenity
Diffstat (limited to 'Meta/Lagom/CMakeLists.txt')
-rw-r--r-- | Meta/Lagom/CMakeLists.txt | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt index 6a55a6544f..879e723f6d 100644 --- a/Meta/Lagom/CMakeLists.txt +++ b/Meta/Lagom/CMakeLists.txt @@ -8,6 +8,11 @@ project( LANGUAGES C CXX ) +option(BUILD_SHARED_LIBS "Build shared libraries instead of static libraries" ON) +if (ENABLE_OSS_FUZZ) + set(BUILD_SHARED_LIBS OFF) # Don't use shared libraries on oss-fuzz, for ease of integration with their infrastructure +endif() + # This is required for CMake (when invoked for a Lagom-only build) to # ignore any files downloading during the build, e.g. UnicodeData.txt. # https://cmake.org/cmake/help/latest/policy/CMP0058.html @@ -142,10 +147,8 @@ endif() function(lagom_lib library fs_name) cmake_parse_arguments(LAGOM_LIBRARY "" "" "SOURCES;LIBS" ${ARGN}) - # FIXME: Consider whether to care about -DBUILD_SHARED_LIBS=OFF - # Possibly a cmake presets value? set(target_name "Lagom${library}") - add_library(${target_name} SHARED ${LAGOM_LIBRARY_SOURCES}) + add_library(${target_name} ${LAGOM_LIBRARY_SOURCES}) # alias for pretty exports add_library(Lagom::${library} ALIAS ${target_name}) @@ -422,7 +425,6 @@ if (BUILD_LAGOM) list(FILTER LIBTEST_SOURCES EXCLUDE REGEX ".*Main.cpp$") add_library( LagomTest - SHARED ${LIBTEST_SOURCES} ) target_link_libraries(LagomTest LagomCore) |