Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CMake file #300

Merged
merged 1 commit into from
Jan 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ option(ZYDIS_FUZZ_AFL_FAST
option(ZYDIS_LIBFUZZER
"Enables LLVM libfuzzer mode and reduces prints in ZydisFuzzIn"
OFF)
option(ZYDIS_SYSTEM_ZYCORE

# Dependencies
option(ZYAN_SYSTEM_ZYCORE
"Use system Zycore library"
OFF)
set(ZYDIS_ZYCORE_PATH
set(ZYAN_ZYCORE_PATH
"${CMAKE_CURRENT_LIST_DIR}/dependencies/zycore"
CACHE
PATH
Expand All @@ -62,12 +64,12 @@ set(ZYDIS_ZYCORE_PATH
# Dependencies #
# =============================================================================================== #

if (ZYDIS_SYSTEM_ZYCORE)
if (ZYAN_SYSTEM_ZYCORE)
find_package(Zycore)
else ()
# Try to initialize the Zycore submodule using Git
if (NOT EXISTS "${ZYDIS_ZYCORE_PATH}/CMakeLists.txt" AND
"${ZYDIS_ZYCORE_PATH}" STREQUAL "${CMAKE_CURRENT_LIST_DIR}/dependencies/zycore")
if (NOT EXISTS "${ZYAN_ZYCORE_PATH}/CMakeLists.txt" AND
"${ZYAN_ZYCORE_PATH}" STREQUAL "${CMAKE_CURRENT_LIST_DIR}/dependencies/zycore")
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
execute_process(
Expand All @@ -77,7 +79,7 @@ else ()
endif()
endif ()

if (NOT EXISTS "${ZYDIS_ZYCORE_PATH}/CMakeLists.txt")
if (NOT EXISTS "${ZYAN_ZYCORE_PATH}/CMakeLists.txt")
message(
FATAL_ERROR
"Can't find zycore submodule. Please make sure to clone the repo recursively.\n"
Expand All @@ -89,7 +91,7 @@ else ()
)
endif ()

add_subdirectory(${ZYDIS_ZYCORE_PATH} "zycore" EXCLUDE_FROM_ALL)
add_subdirectory(${ZYAN_ZYCORE_PATH} "zycore" EXCLUDE_FROM_ALL)
endif ()

# =============================================================================================== #
Expand Down