Fix openssl cross-compiling
[novacoin.git] / CMakeLists.txt
index 3bdca90..6118dd4 100644 (file)
@@ -40,7 +40,10 @@ set(CMAKE_CXX_EXTENSIONS OFF)
 find_package(Qt5 COMPONENTS LinguistTools Core Widgets Gui Network Qml REQUIRED)
 
 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 -fstack-protector-all -Wstack-protector -D_FORTIFY_SOURCE=2")
 set (CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter -fexceptions -frtti")
 else()
 set(CMAKE_C_FLAGS "/O2")
@@ -48,6 +51,7 @@ set(CMAKE_CXX_FLAGS "/O2 /GR /EHsc")
 endif()
 
 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)
@@ -196,7 +200,8 @@ list(APPEND ALL_LIBRARIES ${Boost_LIBRARIES} ixwebsocket OpenSSL::Crypto qrencod
 if (WIN32)
     configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/qt/res/bitcoin-qt.rc bitcoin-qt.rc)
     list(APPEND ALL_SOURCES bitcoin-qt.rc)
-    list(APPEND ALL_LIBRARIES ws2_32 shlwapi mswsock ole32 oleaut32 uuid gdi32)
+    list(APPEND ALL_LIBRARIES ws2_32 shlwapi mswsock ole32 oleaut32 uuid gdi32 pthread)
+    list(APPEND ALL_DEFINITIONS WIN32)
 endif()
 
 if (APPLE)