Skip to content

Instantly share code, notes, and snippets.

@dimecoin
Last active January 9, 2017 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimecoin/094c1378c423a4fb46586186723001db to your computer and use it in GitHub Desktop.
Save dimecoin/094c1378c423a4fb46586186723001db to your computer and use it in GitHub Desktop.
cmake for static builds of xmr-stak-cpu
project(xmr-stak-cpu)
cmake_minimum_required(VERSION 2.8.10)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
message(FATAL_ERROR "GCC version must be at least 5.1!")
endif()
endif()
#SET(CMAKE_VERBOSE_MAKEFILE ON)
SET(CMAKE_C_FLAGS "-DNDEBUG -march=westmere -O3 -m64")
SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11")
set(EXECUTABLE_OUTPUT_PATH "bin")
file(GLOB SOURCES "crypto/*.c" "*.cpp")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
add_executable(xmr-stak-cpu ${SOURCES})
target_link_libraries(xmr-stak-cpu pthread)
@dimecoin
Copy link
Author

dimecoin commented Jan 9, 2017

This was merged. Please use the 'static' build option instead of this config. Keeping for reference.

To do a static build for a system without gcc 5.1+

    cmake -DCMAKE_BUILD_TYPE=STATIC
    make

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment