From bc7b9bc915f6e3d332877239351f957ad7f61684 Mon Sep 17 00:00:00 2001 From: Elias Bachaalany Date: Thu, 16 Jan 2025 13:03:24 -0800 Subject: [PATCH 1/2] exclude 'zlib' shared project from emulator lib Shared targets are not compatible with emulator lib. --- src/CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 24b3d98f..737b1438 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,7 +2,16 @@ add_subdirectory(common) add_subdirectory(emulator) add_subdirectory(unicorn-emulator) add_subdirectory(windows-emulator) -if (NOT MOMO_BUILD_AS_LIBRARY) + +if (MOMO_BUILD_AS_LIBRARY) + if (TARGET zlib) + # Remove all properties and dependencies from the zlib shared lib target + # (this will keep the zlibstatic target) + set_target_properties(zlib PROPERTIES EXCLUDE_FROM_ALL TRUE) + set_target_properties(zlib PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE) + message(STATUS "Target 'zlib' has been disabled in emulator-lib mode.") + endif() +else() add_subdirectory(analyzer) add_subdirectory(fuzzing-engine) add_subdirectory(fuzzer) From 1ce56e163b18af55d4a381d5cbe01940304b575d Mon Sep 17 00:00:00 2001 From: Elias Bachaalany Date: Fri, 17 Jan 2025 06:36:33 -0800 Subject: [PATCH 2/2] always disable zlib shared target --- deps/zlib.cmake | 10 +++++++++- src/CMakeLists.txt | 11 +---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/deps/zlib.cmake b/deps/zlib.cmake index b2f92fb6..03cd234b 100644 --- a/deps/zlib.cmake +++ b/deps/zlib.cmake @@ -1,4 +1,12 @@ set(ZLIB_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) add_subdirectory(zlib) target_compile_definitions(zlibstatic PUBLIC ZLIB_CONST=1) -target_include_directories(zlibstatic PUBLIC ${zlib_SOURCE_DIR} ${zlib_BINARY_DIR}) \ No newline at end of file +target_include_directories(zlibstatic PUBLIC ${zlib_SOURCE_DIR} ${zlib_BINARY_DIR}) + +if (TARGET zlib) + # Remove all properties and dependencies from the zlib shared lib target + # (this will keep the zlibstatic target) + set_target_properties(zlib PROPERTIES EXCLUDE_FROM_ALL TRUE) + set_target_properties(zlib PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE) + message(STATUS "Target 'zlib' has been disabled.") +endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 737b1438..24b3d98f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,16 +2,7 @@ add_subdirectory(common) add_subdirectory(emulator) add_subdirectory(unicorn-emulator) add_subdirectory(windows-emulator) - -if (MOMO_BUILD_AS_LIBRARY) - if (TARGET zlib) - # Remove all properties and dependencies from the zlib shared lib target - # (this will keep the zlibstatic target) - set_target_properties(zlib PROPERTIES EXCLUDE_FROM_ALL TRUE) - set_target_properties(zlib PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE) - message(STATUS "Target 'zlib' has been disabled in emulator-lib mode.") - endif() -else() +if (NOT MOMO_BUILD_AS_LIBRARY) add_subdirectory(analyzer) add_subdirectory(fuzzing-engine) add_subdirectory(fuzzer)