[poppler] cmake/modules

Adrian Johnson ajohnson at kemper.freedesktop.org
Wed Sep 13 09:56:33 UTC 2017


 cmake/modules/PopplerMacros.cmake |   44 ++++++++++++++++++++------------------
 1 file changed, 24 insertions(+), 20 deletions(-)

New commits:
commit 951e7b3c1f337ceaf490edce3c575f89c45cb6d4
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Wed Sep 13 19:24:07 2017 +0930

    cmake: ensure user cflags/cxxflags are appended to end

diff --git a/cmake/modules/PopplerMacros.cmake b/cmake/modules/PopplerMacros.cmake
index 408e6dca..442e7ee5 100644
--- a/cmake/modules/PopplerMacros.cmake
+++ b/cmake/modules/PopplerMacros.cmake
@@ -100,7 +100,7 @@ endif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
 
 if(CMAKE_COMPILER_IS_GNUCXX)
    if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0")
-      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override" )
+      set(CMAKE_CXX_FLAGS "-Wsuggest-override ${CMAKE_CXX_FLAGS}" )
    endif()
 
   # set the default compile warnings
@@ -108,18 +108,20 @@ if(CMAKE_COMPILER_IS_GNUCXX)
   set(DEFAULT_COMPILE_WARNINGS_YES "-Wall -Wcast-align -fno-exceptions -fno-check-new -fno-common")
   set(DEFAULT_COMPILE_WARNINGS_KDE "-Wno-long-long -Wundef -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -Wcast-align -Wconversion -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common")
 
-  set(CMAKE_CXX_FLAGS                "-Wnon-virtual-dtor -Woverloaded-virtual -D_DEFAULT_SOURCE ${CMAKE_CXX_FLAGS}")
-  set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
-  set(CMAKE_CXX_FLAGS_RELEASE        "-O2 -DNDEBUG")
-  set(CMAKE_CXX_FLAGS_DEBUG          "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline")
-  set(CMAKE_CXX_FLAGS_DEBUGFULL      "-g3 -fno-inline")
-  set(CMAKE_CXX_FLAGS_PROFILE        "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
+  set(_save_cxxflags "${CMAKE_CXX_FLAGS}")
+  set(CMAKE_CXX_FLAGS                "-Wnon-virtual-dtor -Woverloaded-virtual -D_DEFAULT_SOURCE")
+  set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g ${_save_cxxflags}")
+  set(CMAKE_CXX_FLAGS_RELEASE        "-O2 -DNDEBUG ${_save_cxxflags}")
+  set(CMAKE_CXX_FLAGS_DEBUG          "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline ${_save_cxxflags}")
+  set(CMAKE_CXX_FLAGS_DEBUGFULL      "-g3 -fno-inline ${_save_cxxflags}")
+  set(CMAKE_CXX_FLAGS_PROFILE        "-g3 -fno-inline -ftest-coverage -fprofile-arcs ${_save_cxxflags}")
+  set(_save_cflags "${CMAKE_C_FLAGS}")
   set(CMAKE_C_FLAGS                  "-std=c99")
-  set(CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -g")
-  set(CMAKE_C_FLAGS_RELEASE          "-O2 -DNDEBUG")
-  set(CMAKE_C_FLAGS_DEBUG            "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline")
-  set(CMAKE_C_FLAGS_DEBUGFULL        "-g3 -fno-inline")
-  set(CMAKE_C_FLAGS_PROFILE          "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
+  set(CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -g ${_save_cflags}")
+  set(CMAKE_C_FLAGS_RELEASE          "-O2 -DNDEBUG ${_save_cflags}")
+  set(CMAKE_C_FLAGS_DEBUG            "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline ${_save_cflags}")
+  set(CMAKE_C_FLAGS_DEBUGFULL        "-g3 -fno-inline ${_save_cflags}")
+  set(CMAKE_C_FLAGS_PROFILE          "-g3 -fno-inline -ftest-coverage -fprofile-arcs ${_save_cflags}")
 
   poppler_check_link_flag("-Wl,--as-needed" GCC_HAS_AS_NEEDED)
   if(GCC_HAS_AS_NEEDED)
@@ -130,13 +132,15 @@ if(CMAKE_COMPILER_IS_GNUCXX)
 endif (CMAKE_COMPILER_IS_GNUCXX)
 
 if(CMAKE_C_COMPILER MATCHES "icc")
-  set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
-  set(CMAKE_CXX_FLAGS_RELEASE        "-O2 -DNDEBUG")
-  set(CMAKE_CXX_FLAGS_DEBUG          "-O2 -g -0b0 -noalign")
-  set(CMAKE_CXX_FLAGS_DEBUGFULL      "-g -Ob0 -noalign")
-  set(CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -g")
-  set(CMAKE_C_FLAGS_RELEASE          "-O2 -DNDEBUG")
-  set(CMAKE_C_FLAGS_DEBUG            "-O2 -g -Ob0 -noalign")
-  set(CMAKE_C_FLAGS_DEBUGFULL        "-g -Ob0 -noalign")
+  set(_save_cxxflags "${CMAKE_CXX_FLAGS}")
+  set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g ${_save_cxxflags}")
+  set(CMAKE_CXX_FLAGS_RELEASE        "-O2 -DNDEBUG ${_save_cxxflags}")
+  set(CMAKE_CXX_FLAGS_DEBUG          "-O2 -g -0b0 -noalign ${_save_cxxflags}")
+  set(CMAKE_CXX_FLAGS_DEBUGFULL      "-g -Ob0 -noalign ${_save_cxxflags}")
+  set(_save_cflags "${CMAKE_C_FLAGS}")
+  set(CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -g ${_save_cflags}")
+  set(CMAKE_C_FLAGS_RELEASE          "-O2 -DNDEBUG ${_save_cflags}")
+  set(CMAKE_C_FLAGS_DEBUG            "-O2 -g -Ob0 -noalign ${_save_cflags}")
+  set(CMAKE_C_FLAGS_DEBUGFULL        "-g -Ob0 -noalign ${_save_cflags}")
 endif(CMAKE_C_COMPILER MATCHES "icc")
 


More information about the poppler mailing list