From: user Date: Sun, 26 Dec 2021 00:16:05 +0000 (+0300) Subject: Use -fPIC only on relevant platforms X-Git-Tag: nvc-v0.5.9~44 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=0662b79a931f0232b0f97cd6ff644e500b94f3d1 Use -fPIC only on relevant platforms --- diff --git a/CMakeLists.txt b/CMakeLists.txt index f62cafe..9a14288 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b138fcc..c5747e9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -26,7 +26,10 @@ 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 -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")