diff --git a/CMakeLists.txt b/CMakeLists.txt index 78270e806..f5e5d9afd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -198,10 +198,6 @@ include_directories(src) include_directories(src/3rdparty) include_directories(${UV_INCLUDE_DIR}) -if (BUILD_STATIC) - set(CMAKE_EXE_LINKER_FLAGS " -static") -endif() - if (WITH_DEBUG_LOG) add_definitions(/DAPP_DEBUG) endif() diff --git a/cmake/flags.cmake b/cmake/flags.cmake index 7c2c79b8d..7b6d0163b 100644 --- a/cmake/flags.cmake +++ b/cmake/flags.cmake @@ -45,6 +45,10 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++") endif() + if (BUILD_STATIC) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static") + endif() + add_definitions(/D_GNU_SOURCE) if (${CMAKE_VERSION} VERSION_LESS "3.1.0") diff --git a/src/backend/cuda/cuda.cmake b/src/backend/cuda/cuda.cmake index 75799cd8b..d75fc395d 100644 --- a/src/backend/cuda/cuda.cmake +++ b/src/backend/cuda/cuda.cmake @@ -1,3 +1,9 @@ +if (BUILD_STATIC AND XMRIG_OS_LINUX AND WITH_CUDA) + message(WARNING "CUDA backend is not compatible with static build, use -DWITH_CUDA=OFF to suppress this warning") + + set(WITH_CUDA OFF) +endif() + if (WITH_CUDA) add_definitions(/DXMRIG_FEATURE_CUDA) diff --git a/src/backend/opencl/opencl.cmake b/src/backend/opencl/opencl.cmake index c53e1f029..8d9235f37 100644 --- a/src/backend/opencl/opencl.cmake +++ b/src/backend/opencl/opencl.cmake @@ -1,3 +1,9 @@ +if (BUILD_STATIC AND XMRIG_OS_LINUX AND WITH_OPENCL) + message(WARNING "OpenCL backend is not compatible with static build, use -DWITH_OPENCL=OFF to suppress this warning") + + set(WITH_OPENCL OFF) +endif() + if (WITH_OPENCL) add_definitions(/DCL_TARGET_OPENCL_VERSION=200) add_definitions(/DCL_USE_DEPRECATED_OPENCL_1_2_APIS)