X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2FCMakeLists.txt;h=7d8f3c51d3d13c8f858ffe3ebdb984d6f59d4cc9;hb=03194e9e5aa5295b935d71e15535023e6cbf1e05;hp=0b226ac8d3826c380d72f8ea70636389be98c8de;hpb=711f7859cd03feb687fa850f332a3101519a0030;p=novacoin.git diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0b226ac..7d8f3c5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -26,16 +26,20 @@ if(CCACHE_FOUND) endif(CCACHE_FOUND) if (NOT MSVC) -set (CMAKE_C_FLAGS "-flto -O3 -fPIC -Wno-deprecated -fstack-protector-all -Wstack-protector -D_FORTIFY_SOURCE=2") +if (NOT WIN32) +set(FPIC "-fPIC") +endif() +set (CMAKE_C_FLAGS "-flto -O3 ${FPIC} -Wno-deprecated") set (CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter -fexceptions -frtti") else() set(CMAKE_C_FLAGS "/O2") -set(CMAKE_CXX_FLAGS "/O2 /GR") +set(CMAKE_CXX_FLAGS "/O2 /GR /EHsc") endif() set(CMAKE_CXX_EXTENSIONS OFF) set(Boost_USE_STATIC_LIBS ON) +set(Boost_USE_STATIC_RUNTIME ON) find_package(Boost REQUIRED COMPONENTS atomic chrono filesystem program_options system thread) set(OPENSSL_USE_STATIC_LIBS ON) find_package(OpenSSL REQUIRED) @@ -110,9 +114,14 @@ set(generic_sources list(APPEND ALL_SOURCES ${generic_sources}) list(APPEND ALL_LIBRARIES ${Boost_LIBRARIES} ixwebsocket OpenSSL::Crypto) -# Windows-specific libraries if (WIN32) - list(APPEND ALL_LIBRARIES kernel32 user32 gdi32 comdlg32 winspool winmm shell32 comctl32 ole32 oleaut32 uuid rpcrt4 advapi32 ws2_32 mswsock shlwapi) + # Windows-specific libraries + list(APPEND ALL_LIBRARIES kernel32 user32 gdi32 comdlg32 winspool winmm shell32 comctl32 ole32 oleaut32 uuid rpcrt4 advapi32 ws2_32 mswsock shlwapi pthread) + list(APPEND ALL_DEFINITIONS WIN32) + + # Resources + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/bitcoin.rc bitcoin.rc) + list(APPEND ALL_SOURCES ${CMAKE_BINARY_DIR}/bitcoin.rc) endif() # Some systems need rt library @@ -162,7 +171,17 @@ execute_process ( list(APPEND ALL_DEFINITIONS HAVE_BUILD_INFO USE_IPV6) add_executable(novacoind ${ALL_SOURCES}) -target_include_directories(novacoind PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/json ${BerkeleyDB_INC} ${CMAKE_CURRENT_SOURCE_DIR}/additional/sse2neon ${CMAKE_CURRENT_SOURCE_DIR}/additional/leveldb/helpers ${Boost_INCLUDE_DIRS}) + +if (NOT MSVC) +list(APPEND ALL_LIBRARIES ssp) +list(APPEND ALL_DEFINITIONS _FORTIFY_SOURCE=2) +if (WIN32) +list(APPEND ALL_LIBRARIES mingw32) +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static") +endif() +endif() + +target_include_directories(novacoind PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/json ${BerkeleyDB_INC} ${CMAKE_CURRENT_SOURCE_DIR}/additional/leveldb/helpers ${Boost_INCLUDE_DIRS}) target_link_libraries(novacoind ${ALL_LIBRARIES}) target_compile_features(novacoind PUBLIC cxx_std_17)