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

CMake fixes #777

Merged
merged 3 commits into from
May 29, 2020
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion deps/openssl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ elseif(OS_LINUX)
set(OPENSSL_CONFIGURE_ARCH "linux-generic64")
endif()
elseif(OS_DARWIN)
set(OPENSSL_MAKE make -j${CPUS})
execute_process(
COMMAND xcrun --show-sdk-path
OUTPUT_VARIABLE MACOS_SDK_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(OPENSSL_MAKE make SDKROOT=${MACOS_SDK_PATH} -j${CPUS})
if(ARCH_X86)
set(OPENSSL_CONFIGURE_ARCH "darwin-i386-cc")
elseif(ARCH_X64)
Expand Down
20 changes: 10 additions & 10 deletions deps/yara/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ else()
set(YARAC_PATH ${YARA_DIR}/yarac)
endif()

# https://github.com/avast/retdec/issues/439
if(APPLE)
execute_process(
COMMAND xcrun --show-sdk-path
OUTPUT_VARIABLE MACOS_SDK_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --sysroot=${MACOS_SDK_PATH}")
endif()

# These are not used on MSVC, but we use it on all platforms to detect if
# build configuration changed - changes in config should be mirrored on both
# MSVC & Linux.
Expand Down Expand Up @@ -101,16 +111,6 @@ else()
)
endif()

# https://github.com/avast/retdec/issues/439
if(APPLE)
execute_process(
COMMAND xcrun --show-sdk-path
OUTPUT_VARIABLE MACOS_SDK_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --sysroot=${MACOS_SDK_PATH}")
endif()

if(NOT MSVC)
ExternalProject_Add_Step(yara configure-linux
WORKING_DIRECTORY ${YARA_DIR}
Expand Down
6 changes: 3 additions & 3 deletions support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ does not match the current version '\${YARAC_CURRENT_VERSION}' \
install(CODE "
execute_process(
# -u = unbuffered -> print debug messages right away.
COMMAND \"${PYTHON_EXECUTABLE}\" -u \"${CMAKE_SOURCE_DIR}/support/install-share.py\" \"${CMAKE_INSTALL_PREFIX}\" \"${SUPPORT_PKG_URL}\" \"${SUPPORT_PKG_SHA256}\" \"${SUPPORT_PKG_VERSION}\"
COMMAND \"${PYTHON_EXECUTABLE}\" -u \"${PROJECT_SOURCE_DIR}/support/install-share.py\" \"${CMAKE_INSTALL_PREFIX}\" \"${SUPPORT_PKG_URL}\" \"${SUPPORT_PKG_SHA256}\" \"${SUPPORT_PKG_VERSION}\"
RESULT_VARIABLE INSTALL_SHARE_RES
)
if(INSTALL_SHARE_RES)
Expand Down Expand Up @@ -91,14 +91,14 @@ install(

# Install YARA rules for tools detection.
#
set(YARA_INSTALL_PY "${CMAKE_SOURCE_DIR}/support/install-yara.py")
set(YARA_INSTALL_PY "${PROJECT_SOURCE_DIR}/support/install-yara.py")

install(CODE "
execute_process(
COMMAND \"${PYTHON_EXECUTABLE}\" -u \"${YARA_INSTALL_PY}\"
\"${YARAC_PATH}\"
\"${SUPPORT_TARGET_DIR}\"
\"${CMAKE_SOURCE_DIR}/support/yara_patterns\"
\"${PROJECT_SOURCE_DIR}/support/yara_patterns\"
${RETDEC_COMPILE_YARA}
RESULT_VARIABLE INSTALL_YARA_RES
)
Expand Down