Skip to content

Instantly share code, notes, and snippets.

@eacousineau
Created April 5, 2014 18:33
Show Gist options
  • Save eacousineau/9996056 to your computer and use it in GitHub Desktop.
Save eacousineau/9996056 to your computer and use it in GitHub Desktop.
musescore_issue_fPIC.patch
From 6a16f029b4d5d5be1fe202bc961d919d85764203 Mon Sep 17 00:00:00 2001
From: eacousineau <[email protected]>
Date: Sat, 5 Apr 2014 13:31:49 -0500
Subject: [PATCH] CMakeLists: Haphazardly add -fPIC for gcc to see if we can
squelch the Qt5.2 #error directive
---
CMakeLists.txt | 5 +++++
aeolus/CMakeLists.txt | 2 +-
audiofile/CMakeLists.txt | 4 +++-
awl/CMakeLists.txt | 2 +-
build/gch.cmake | 1 +
bww2mxml/CMakeLists.txt | 2 +-
effects/CMakeLists.txt | 2 +-
fluid/CMakeLists.txt | 2 +-
libmscore/CMakeLists.txt | 4 ++--
manual/CMakeLists.txt | 4 ++--
midi/CMakeLists.txt | 2 +-
mscore/CMakeLists.txt | 6 ++++--
mstyle/CMakeLists.txt | 2 +-
mtest/CMakeLists.txt | 2 +-
omr/CMakeLists.txt | 2 +-
synthesizer/CMakeLists.txt | 2 +-
thirdparty/diff/CMakeLists.txt | 2 +-
thirdparty/ofqf/CMakeLists.txt | 2 +-
thirdparty/rtf2html/CMakeLists.txt | 2 +-
thirdparty/singleapp/src/CMakeLists.txt | 2 +-
zerberus/CMakeLists.txt | 2 +-
21 files changed, 32 insertions(+), 22 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 22bf346..00ed291 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -237,6 +237,7 @@ ELSE(BUILD_JACK)
ENDIF(BUILD_JACK)
+
##
## portaudio
##
@@ -309,6 +310,8 @@ else(APPLE)
set(VORBIS_LIB vorbis)
endif(APPLE)
+add_definitions(-fPIC)
+
##
## QtSingleApplication
##
@@ -418,6 +421,8 @@ include_directories(
${LAME_INCLUDE_DIR}
)
+# add_definitions(-fPIC)
+
##
## Include packaging
##
diff --git a/aeolus/CMakeLists.txt b/aeolus/CMakeLists.txt
index 84e9416..ceb5a3b 100644
--- a/aeolus/CMakeLists.txt
+++ b/aeolus/CMakeLists.txt
@@ -45,7 +45,7 @@ add_library (aeolus STATIC
set_target_properties (
aeolus
PROPERTIES
- COMPILE_FLAGS "${PCH_INCLUDE} -g -Wall -Wextra -Winvalid-pch"
+ COMPILE_FLAGS "${PCH_INCLUDE} -fPIC -g -Wall -Wextra -Winvalid-pch"
)
install(DIRECTORY
diff --git a/audiofile/CMakeLists.txt b/audiofile/CMakeLists.txt
index 35276eb..fbe1ba5 100644
--- a/audiofile/CMakeLists.txt
+++ b/audiofile/CMakeLists.txt
@@ -18,6 +18,8 @@ else (APPLE)
set(INCS "")
endif (APPLE)
+add_definitions(-fPIC)
+
add_library (audiofile STATIC
${PROJECT_BINARY_DIR}/all.h
${PCH}
@@ -26,7 +28,7 @@ add_library (audiofile STATIC
set_target_properties (
audiofile
PROPERTIES
- COMPILE_FLAGS "${PCH_INCLUDE} -g -Wall -Wextra -Winvalid-pch"
+ COMPILE_FLAGS "${PCH_INCLUDE} -fPIC -g -Wall -Wextra -Winvalid-pch"
)
xcode_pch(audiofile all)
diff --git a/awl/CMakeLists.txt b/awl/CMakeLists.txt
index 1b40938..dcb96fe 100644
--- a/awl/CMakeLists.txt
+++ b/awl/CMakeLists.txt
@@ -67,7 +67,7 @@ add_library (
set_target_properties (
awl
PROPERTIES
- COMPILE_FLAGS "${PCH_INCLUDE} -g -Wall -Wextra -Winvalid-pch"
+ COMPILE_FLAGS "${PCH_INCLUDE} -fPIC -g -Wall -Wextra -Winvalid-pch"
)
xcode_pch(awl all)
diff --git a/build/gch.cmake b/build/gch.cmake
index 0c328bc..cdd8e06 100644
--- a/build/gch.cmake
+++ b/build/gch.cmake
@@ -18,6 +18,7 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#=============================================================================
+add_definitions(-fPIC)
SET_SOURCE_FILES_PROPERTIES(
${PCH}
diff --git a/bww2mxml/CMakeLists.txt b/bww2mxml/CMakeLists.txt
index d6b7794..ba57203 100644
--- a/bww2mxml/CMakeLists.txt
+++ b/bww2mxml/CMakeLists.txt
@@ -49,7 +49,7 @@ if (NOT MINGW AND NOT APPLE)
set_target_properties (
bww2mxml
PROPERTIES
- COMPILE_FLAGS "-x c++ -include ${PROJECT_BINARY_DIR}/all.h -g -Wall -Wextra -Winvalid-pch"
+ COMPILE_FLAGS "-x c++ -include ${PROJECT_BINARY_DIR}/all.h -fPIC -g -Wall -Wextra -Winvalid-pch"
)
target_link_libraries(bww2mxml
diff --git a/effects/CMakeLists.txt b/effects/CMakeLists.txt
index ab5f16e..8fe798f 100644
--- a/effects/CMakeLists.txt
+++ b/effects/CMakeLists.txt
@@ -49,7 +49,7 @@ add_library (effects STATIC
set_target_properties (
effects
PROPERTIES
- COMPILE_FLAGS "${PCH_INCLUDE} -g -Wall -Wextra -Winvalid-pch"
+ COMPILE_FLAGS "${PCH_INCLUDE} -fPIC -g -Wall -Wextra -Winvalid-pch"
)
xcode_pch(effects all)
diff --git a/fluid/CMakeLists.txt b/fluid/CMakeLists.txt
index fe48adc..3b46f33 100644
--- a/fluid/CMakeLists.txt
+++ b/fluid/CMakeLists.txt
@@ -47,7 +47,7 @@ add_library (fluid STATIC
set_target_properties (
fluid
PROPERTIES
- COMPILE_FLAGS "${PCH_INCLUDE} -g -Wall -Wextra -Winvalid-pch"
+ COMPILE_FLAGS "${PCH_INCLUDE} -fPIC -g -Wall -Wextra -Winvalid-pch"
)
xcode_pch(fluid all)
diff --git a/libmscore/CMakeLists.txt b/libmscore/CMakeLists.txt
index 5bcc900..b949ffe 100644
--- a/libmscore/CMakeLists.txt
+++ b/libmscore/CMakeLists.txt
@@ -84,13 +84,13 @@ if (SCRIPT_INTERFACE)
set_target_properties (
libmscore
PROPERTIES
- COMPILE_FLAGS "-g ${PCH_INCLUDE} -Wall -Wextra -Winvalid-pch"
+ COMPILE_FLAGS "-g ${PCH_INCLUDE} -fPIC -Wall -Wextra -Winvalid-pch"
)
else (SCRIPT_INTERFACE)
set_target_properties (
libmscore
PROPERTIES
- COMPILE_FLAGS "-g ${PCH_INCLUDE} -include libmscore/noscript.h -Wall -Wextra -Winvalid-pch"
+ COMPILE_FLAGS "-g ${PCH_INCLUDE} -fPIC -include libmscore/noscript.h -Wall -Wextra -Winvalid-pch"
)
endif (SCRIPT_INTERFACE)
diff --git a/manual/CMakeLists.txt b/manual/CMakeLists.txt
index dff4cc3..4883f41 100644
--- a/manual/CMakeLists.txt
+++ b/manual/CMakeLists.txt
@@ -36,12 +36,12 @@ if(APPLE)
set_target_properties (
genManual
PROPERTIES
- COMPILE_FLAGS "-include all.h -D TESTROOT=\\\\\"${PROJECT_SOURCE_DIR}\\\\\" -g -Wall -Wextra"
+ COMPILE_FLAGS "-include all.h -fPIC -D TESTROOT=\\\\\"${PROJECT_SOURCE_DIR}\\\\\" -g -Wall -Wextra"
)
else(APPLE)
set_target_properties (
genManual
PROPERTIES
- COMPILE_FLAGS "-include all.h -D TESTROOT=\\\"${PROJECT_SOURCE_DIR}\\\" -g -Wall -Wextra"
+ COMPILE_FLAGS "-include all.h -fPIC -D TESTROOT=\\\"${PROJECT_SOURCE_DIR}\\\" -g -Wall -Wextra"
)
endif(APPLE)
diff --git a/midi/CMakeLists.txt b/midi/CMakeLists.txt
index 6771ca3..8e1afc2 100644
--- a/midi/CMakeLists.txt
+++ b/midi/CMakeLists.txt
@@ -27,7 +27,7 @@ add_library (midi STATIC
set_target_properties (
midi
PROPERTIES
- COMPILE_FLAGS "${PCH_INCLUDE} -g -Wall -Wextra -Winvalid-pch"
+ COMPILE_FLAGS "${PCH_INCLUDE} -fPIC -g -Wall -Wextra -Winvalid-pch"
)
xcode_pch(midi all)
diff --git a/mscore/CMakeLists.txt b/mscore/CMakeLists.txt
index 228febf..23264e9 100644
--- a/mscore/CMakeLists.txt
+++ b/mscore/CMakeLists.txt
@@ -216,6 +216,8 @@ else (APPLE)
set(INCS "")
endif (APPLE)
+add_definitions(-fPIC)
+
add_executable ( ${ExecutableName}
# mops.cpp # HACK! first file disappears during linking as CMake generates
# # something like: gcc ... -L mops.o ...
@@ -342,13 +344,13 @@ if (MINGW)
if(CMAKE_BUILD_TYPE MATCHES "DEBUG")
set_target_properties( mscore
PROPERTIES
- COMPILE_FLAGS "${PCH_INCLUDE} -g -Wall -Wextra -Winvalid-pch ${QT_DEFINITIONS} -DQT_SVG_LIB -DQT_GUI_LIB -DQT_XML_LIB -DQT_CORE_LIB"
+ COMPILE_FLAGS "${PCH_INCLUDE} -fPIC -g -Wall -Wextra -Winvalid-pch ${QT_DEFINITIONS} -DQT_SVG_LIB -DQT_GUI_LIB -DQT_XML_LIB -DQT_CORE_LIB"
LINK_FLAGS "${PROJECT_BINARY_DIR}/resfile.o -mwindows -mconsole -L ${CROSSQT}/lib"
)
else(CMAKE_BUILD_TYPE MATCHES "DEBUG")
set_target_properties( mscore
PROPERTIES
- COMPILE_FLAGS "${PCH_INCLUDE} -Wall -Wextra -Winvalid-pch ${QT_DEFINITIONS} -DQT_SVG_LIB -DQT_GUI_LIB -DQT_XML_LIB -DQT_CORE_LIB"
+ COMPILE_FLAGS "${PCH_INCLUDE} -fPIC -Wall -Wextra -Winvalid-pch ${QT_DEFINITIONS} -DQT_SVG_LIB -DQT_GUI_LIB -DQT_XML_LIB -DQT_CORE_LIB"
LINK_FLAGS "-Wl,-S ${PROJECT_BINARY_DIR}/resfile.o -mwindows -L ${CROSSQT}/lib"
)
endif(CMAKE_BUILD_TYPE MATCHES "DEBUG")
diff --git a/mstyle/CMakeLists.txt b/mstyle/CMakeLists.txt
index e3b9ced..966559b 100644
--- a/mstyle/CMakeLists.txt
+++ b/mstyle/CMakeLists.txt
@@ -64,7 +64,7 @@ add_library (
set_target_properties (
mstyle
PROPERTIES
- COMPILE_FLAGS "${PCH_INCLUDE} -g -Wall -Wextra -Winvalid-pch"
+ COMPILE_FLAGS "${PCH_INCLUDE} -fPIC -g -Wall -Wextra -Winvalid-pch"
)
xcode_pch(mstyle all)
diff --git a/mtest/CMakeLists.txt b/mtest/CMakeLists.txt
index dfdc2c8..f663c60 100644
--- a/mtest/CMakeLists.txt
+++ b/mtest/CMakeLists.txt
@@ -85,7 +85,7 @@ string(REPLACE ";" ";-I" INC "${QT_INCLUDES}")
set_target_properties (
testutils
PROPERTIES
- COMPILE_FLAGS "-include all.h -D TESTROOT=\\\"${PROJECT_SOURCE_DIR}\\\" -g -Wall -Wextra"
+ COMPILE_FLAGS "-include all.h -fPIC -D TESTROOT=\\\"${PROJECT_SOURCE_DIR}\\\" -g -Wall -Wextra"
)
# COMPILE_FLAGS "-include all.h -I ${INC} -D TESTROOT=\\\"${PROJECT_SOURCE_DIR}\\\" -g -Wall -Wextra"
diff --git a/omr/CMakeLists.txt b/omr/CMakeLists.txt
index b6df1ef..d449df6 100644
--- a/omr/CMakeLists.txt
+++ b/omr/CMakeLists.txt
@@ -47,7 +47,7 @@ add_library (
set_target_properties (
omr
PROPERTIES
- COMPILE_FLAGS "${PCH_INCLUDE} -g -Wall -Wextra -Winvalid-pch"
+ COMPILE_FLAGS "${PCH_INCLUDE} -fPIC -g -Wall -Wextra -Winvalid-pch"
)
xcode_pch(omr all)
diff --git a/synthesizer/CMakeLists.txt b/synthesizer/CMakeLists.txt
index 42f4696..f1444a4 100644
--- a/synthesizer/CMakeLists.txt
+++ b/synthesizer/CMakeLists.txt
@@ -35,7 +35,7 @@ add_library (synthesizer STATIC
set_target_properties (
synthesizer
PROPERTIES
- COMPILE_FLAGS "${PCH_INCLUDE} -g -Wall -Wextra -Winvalid-pch"
+ COMPILE_FLAGS "${PCH_INCLUDE} -fPIC -g -Wall -Wextra -Winvalid-pch"
)
xcode_pch(synthesizer all)
diff --git a/thirdparty/diff/CMakeLists.txt b/thirdparty/diff/CMakeLists.txt
index d0155b2..3b43141 100644
--- a/thirdparty/diff/CMakeLists.txt
+++ b/thirdparty/diff/CMakeLists.txt
@@ -36,7 +36,7 @@ add_library(diff_match_patch STATIC
set_target_properties (
diff_match_patch
PROPERTIES
- COMPILE_FLAGS "${PCH_INCLUDE} -g -Wall -Wextra -Winvalid-pch"
+ COMPILE_FLAGS "${PCH_INCLUDE} -fPIC -g -Wall -Wextra -Winvalid-pch"
)
xcode_pch(diff_match_patch all)
diff --git a/thirdparty/ofqf/CMakeLists.txt b/thirdparty/ofqf/CMakeLists.txt
index 04831fb..633feed 100644
--- a/thirdparty/ofqf/CMakeLists.txt
+++ b/thirdparty/ofqf/CMakeLists.txt
@@ -43,7 +43,7 @@ add_library(ofqf STATIC
set_target_properties (
ofqf
PROPERTIES
- COMPILE_FLAGS "${PCH_INCLUDE} -g -Wall -Wextra -Winvalid-pch"
+ COMPILE_FLAGS "${PCH_INCLUDE} -fPIC -g -Wall -Wextra -Winvalid-pch"
)
xcode_pch(ofqf all)
diff --git a/thirdparty/rtf2html/CMakeLists.txt b/thirdparty/rtf2html/CMakeLists.txt
index 230339b..fe1b073 100644
--- a/thirdparty/rtf2html/CMakeLists.txt
+++ b/thirdparty/rtf2html/CMakeLists.txt
@@ -37,7 +37,7 @@ add_library (
set_target_properties( rtf2html
PROPERTIES
- COMPILE_FLAGS "${PCH_INCLUDE} -g -Wall -Wextra -Winvalid-pch"
+ COMPILE_FLAGS "${PCH_INCLUDE} -fPIC -g -Wall -Wextra -Winvalid-pch"
)
xcode_pch(rtf2html all)
diff --git a/thirdparty/singleapp/src/CMakeLists.txt b/thirdparty/singleapp/src/CMakeLists.txt
index 40352cd..f6dfaf8 100644
--- a/thirdparty/singleapp/src/CMakeLists.txt
+++ b/thirdparty/singleapp/src/CMakeLists.txt
@@ -37,7 +37,7 @@ add_library (
set_target_properties (
qtsingleapp
PROPERTIES
- COMPILE_FLAGS "${PCH_INCLUDE} -g -Wall -Wextra -Winvalid-pch"
+ COMPILE_FLAGS "${PCH_INCLUDE} -fPIC -g -Wall -Wextra -Winvalid-pch"
)
xcode_pch(qtsingleapp all)
diff --git a/zerberus/CMakeLists.txt b/zerberus/CMakeLists.txt
index 37c0287..c7a6e50 100644
--- a/zerberus/CMakeLists.txt
+++ b/zerberus/CMakeLists.txt
@@ -33,7 +33,7 @@ add_library (zerberus STATIC
set_target_properties (
zerberus
PROPERTIES
- COMPILE_FLAGS "${PCH_INCLUDE} -g -Wall -Wextra -Winvalid-pch"
+ COMPILE_FLAGS "${PCH_INCLUDE} -fPIC -g -Wall -Wextra -Winvalid-pch"
)
xcode_pch(zerberus all)
--
1.8.2.1.390.gd4ee029
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment