From 11f00a2e6e017b9330fb4e7df55d8bffd94ec53f Mon Sep 17 00:00:00 2001 From: kpcyrd Date: Mon, 12 Mar 2018 21:03:04 +0100 Subject: [PATCH] Add -DBUILD_STATIC=ON for static builds See #238 --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e1673ea..ea02d373 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,7 @@ project(xmrig) option(WITH_LIBCPUID "Use Libcpuid" ON) option(WITH_AEON "CryptoNight-Lite support" ON) option(WITH_HTTPD "HTTP REST API" ON) +option(BUILD_STATIC "Build static binary" OFF) include (CheckIncludeFile) include (cmake/cpu.cmake) @@ -204,5 +205,9 @@ include_directories(src) include_directories(src/3rdparty) include_directories(${UV_INCLUDE_DIR}) +if (BUILD_STATIC) + set(CMAKE_EXE_LINKER_FLAGS " -static") +endif() + add_executable(xmrig ${HEADERS} ${SOURCES} ${SOURCES_OS} ${SOURCES_CPUID} ${HEADERS_CRYPTO} ${SOURCES_CRYPTO} ${SOURCES_SYSLOG} ${HTTPD_SOURCES}) target_link_libraries(xmrig ${UV_LIBRARIES} ${MHD_LIBRARY} ${EXTRA_LIBS} ${CPUID_LIB})