1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
Description: Put common flags into CMAKE_CXX_FLAGS
Debhelper intentionally sets CMAKE_BUILD_TYPE to None so that optimization
flags are not added by cmake. Unfortunately musescore only enables --std=c++11
for the Debug and Release build types.
.
This patch moves the common flags (c++ standard, warnings, etc) to
CMAKE_CXX_FLAGS which gets used in all build types.
.
The flags in mtest are duplicated and inherited from the root CMakeLists.txt
anyway, so they can be removed.
.
The PCH build was already not working, but after appplying this patch it fails
outright (the PCH code ignores CMAKE_CXX_FLAGS and all custom flags) so just
disable it.
Author: James Cowgill <jcowgill@debian.org>
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -148,17 +148,20 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "
endif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
if (APPLE)
- set(CMAKE_CXX_FLAGS_DEBUG "-std=c++11 -fPIC -stdlib=libc++ -g -Wno-inconsistent-missing-override")
- set(CMAKE_CXX_FLAGS_RELEASE "-std=c++11 -fPIC -stdlib=libc++ -O2 -DNDEBUG -DQT_NO_DEBUG -Wno-inconsistent-missing-override")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC -stdlib=libc++ -Wno-inconsistent-missing-override")
+ set(CMAKE_CXX_FLAGS_DEBUG "-g")
+ set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG -DQT_NO_DEBUG")
else (APPLE)
if (MINGW)
# -mno-ms-bitfields see #22048
- set(CMAKE_CXX_FLAGS_DEBUG "-std=c++11 -mno-ms-bitfields -g")
- set(CMAKE_CXX_FLAGS_RELEASE "-std=c++11 -mno-ms-bitfields -O2 -DNDEBUG -DQT_NO_DEBUG")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -mno-ms-bitfields")
+ set(CMAKE_CXX_FLAGS_DEBUG "-g")
+ set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG -DQT_NO_DEBUG")
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--large-address-aware")
else (MINGW)
- set(CMAKE_CXX_FLAGS_DEBUG "-std=c++11 -fPIC -fPIE -g")
- set(CMAKE_CXX_FLAGS_RELEASE "-std=c++11 -fPIC -O2 -DNDEBUG -DQT_NO_DEBUG")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC")
+ set(CMAKE_CXX_FLAGS_DEBUG "-fPIE -g")
+ set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG -DQT_NO_DEBUG")
endif (MINGW)
endif(APPLE)
@@ -557,7 +560,7 @@ add_custom_command(
if (MINGW)
set(BUILD_PCH false)
else (MINGW)
- set(BUILD_PCH true)
+ set(BUILD_PCH false)
endif(MINGW)
precompiled_header(QT_INCLUDES all ${BUILD_PCH})
--- a/mtest/CMakeLists.txt
+++ b/mtest/CMakeLists.txt
@@ -112,20 +112,6 @@ target_link_libraries(
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
-if (APPLE)
- set(CMAKE_CXX_FLAGS_DEBUG "-std=c++0x -fPIC -stdlib=libc++ -g -Wno-inconsistent-missing-override")
- set(CMAKE_CXX_FLAGS_RELEASE "-std=c++0x -fPIC -stdlib=libc++ -O2 -DNDEBUG -DQT_NO_DEBUG -Wno-inconsistent-missing-override")
-else (APPLE)
- if (MINGW)
- # -mno-ms-bitfields see #22048
- set(CMAKE_CXX_FLAGS_DEBUG "-std=gnu++0x -mno-ms-bitfields -g")
- set(CMAKE_CXX_FLAGS_RELEASE "-std=gnu++0x -mno-ms-bitfields -O2 -DNDEBUG -DQT_NO_DEBUG")
- else (MINGW)
- set(CMAKE_CXX_FLAGS_DEBUG "-std=gnu++0x -fPIC -fPIE -g")
- set(CMAKE_CXX_FLAGS_RELEASE "-std=gnu++0x -fPIC -O2 -DNDEBUG -DQT_NO_DEBUG")
- endif (MINGW)
-endif(APPLE)
-
string(REPLACE ";" ";-I" INC "${QT_INCLUDES}")
|