Skip to content
Permalink
Browse files

Merge pull request #3509 from mirabilos/global-flags

Move global flags into CMAKE_CXX_FLAGS
  • Loading branch information...
lasconic committed Mar 7, 2018
2 parents acd86d5 + 84f16d4 commit e37f2513e90f1cef36247a22f6b182bce504dd8a
Showing with 9 additions and 22 deletions.
  1. +8 −6 CMakeLists.txt
  2. +1 −1 build/CreatePrecompiledHeader.cmake
  3. +0 −15 mtest/CMakeLists.txt
@@ -168,18 +168,20 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
endif()
endif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")

set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG -DQT_NO_DEBUG")

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")
else (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
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} -mno-ms-bitfields")
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--large-address-aware")
else (MINGW)
set(CMAKE_CXX_FLAGS_DEBUG "-std=gnu++11 -fno-inline -fPIC -g")
set(CMAKE_CXX_FLAGS_RELEASE "-std=gnu++11 -fPIC -O2 -DNDEBUG -DQT_NO_DEBUG")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-inline")
endif (MINGW)
endif(APPLE)

@@ -3,7 +3,7 @@ macro( precompiled_header includes header_name build_pch)
message(STATUS "Precompiled header generation")
# Get the compiler flags for this build type
string( TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" flags_for_build_name )
set( compile_flags ${${flags_for_build_name}} )
set( compile_flags "${CMAKE_CXX_FLAGS} ${${flags_for_build_name}}" )

# Add all the Qt include directories
foreach( item ${${includes}} )
@@ -117,21 +117,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 -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}")

if (APPLE AND (CMAKE_VERSION VERSION_LESS "3.5.0"))

0 comments on commit e37f251

Please sign in to comment.
You can’t perform that action at this time.