[poppler] [PATCH] [CMake] Preserve compile flags
Maciej Mrozowski
reavertm at gmail.com
Fri Apr 9 19:50:51 PDT 2010
From 9ba3a289672cc596d98f4b92dcfe11a61ec85124 Mon Sep 17 00:00:00 2001
From: Maciej Mrozowski <reavertm at gmail.com>
Date: Sat, 10 Apr 2010 04:38:47 +0200
Subject: [PATCH] [CMake] Preserve compiler flags
- preserve GCC compiler flags passed by environment instead of replacing them
with COMPILER_WARNINGS
- add warnings for C compiled objects as well
- use add_definitions() to pass preprocessor definitions instead of
CMAKE_CXX_FLAGS
---
CMakeLists.txt | 15 ---------------
cmake/modules/PopplerMacros.cmake | 13 ++++---------
2 files changed, 4 insertions(+), 24 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0725747..0505dff 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -185,21 +185,6 @@ if(LCMS_FOUND)
include_directories(${LCMS_INCLUDE_DIR})
endif(LCMS_FOUND)
-if(DEFINED COMPILE_WARNINGS)
-else(DEFINED COMPILE_WARNINGS)
- set(COMPILE_WARNINGS "yes")
-endif(DEFINED COMPILE_WARNINGS)
-string(TOLOWER "${COMPILE_WARNINGS}" _comp_warnings)
-if(_comp_warnings STREQUAL "no")
- set(CMAKE_CXX_FLAGS "${DEFAULT_COMPILE_WARNINGS_NO} ${CMAKE_CXX_FLAGS}")
-endif(_comp_warnings STREQUAL "no")
-if(_comp_warnings STREQUAL "yes")
- set(CMAKE_CXX_FLAGS "${DEFAULT_COMPILE_WARNINGS_YES} ${CMAKE_CXX_FLAGS}")
-endif(_comp_warnings STREQUAL "yes")
-if(_comp_warnings STREQUAL "kde")
- set(CMAKE_CXX_FLAGS "${DEFAULT_COMPILE_WARNINGS_KDE} ${CMAKE_CXX_FLAGS}")
-endif(_comp_warnings STREQUAL "kde")
-
include(ConfigureChecks.cmake)
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
diff --git a/cmake/modules/PopplerMacros.cmake
b/cmake/modules/PopplerMacros.cmake
index befd20a..3ca29a9 100644
--- a/cmake/modules/PopplerMacros.cmake
+++ b/cmake/modules/PopplerMacros.cmake
@@ -99,12 +99,9 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
endif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
if(CMAKE_COMPILER_IS_GNUCXX)
- # set the default compile warnings
- set(DEFAULT_COMPILE_WARNINGS_NO)
- set(DEFAULT_COMPILE_WARNINGS_YES "-Wall -Wno-write-strings")
- set(DEFAULT_COMPILE_WARNINGS_KDE "-Wno-long-long -Wundef -
D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts -
Wall -W -Wpointer-arith -Wwrite-strings -O2 -Wformat-security -Wmissing-
format-attribute -fno-exceptions -fno-check-new -fno-common")
-
- set(CMAKE_CXX_FLAGS "-Wnon-virtual-dtor -Woverloaded-
virtual")
+ add_definitions(-D_XOPEN_SOURCE=500 -D_BSD_SOURCE)
+ set(CMAKE_C_FLAGS "-Wall -Wno-write-strings -Wno-long-long -Wundef -Wcast-
align -Wconversion -Wchar-subscripts -W -Wpointer-arith -Wwrite-strings -
Wformat-security -Wmissing-format-attribute -fno-common ${CMAKE_C_FLAGS}")
+ set(CMAKE_CXX_FLAGS "-Wall -Wno-write-strings -Wno-long-long -Wundef -
Wcast-align -Wconversion -Wchar-subscripts -W -Wpointer-arith -Wwrite-strings
-Wformat-security -Wmissing-format-attribute -fno-common -fno-check-new -
Woverloaded-virtual -Wnon-virtual-dtor ${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")
@@ -117,8 +114,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_C_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -
fprofile-arcs")
if(CMAKE_SYSTEM_NAME MATCHES Linux)
- set(DEFAULT_COMPILE_WARNINGS_YES "${DEFAULT_COMPILE_WARNINGS_YES} -ansi")
- set(DEFAULT_COMPILE_WARNINGS_KDE "${DEFAULT_COMPILE_WARNINGS_KDE} -ansi")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi")
endif(CMAKE_SYSTEM_NAME MATCHES Linux)
poppler_check_link_flag("-Wl,--as-needed" GCC_HAS_AS_NEEDED)
@@ -139,4 +135,3 @@ if(CMAKE_C_COMPILER MATCHES "icc")
set(CMAKE_C_FLAGS_DEBUG "-O2 -g -Ob0 -noalign")
set(CMAKE_C_FLAGS_DEBUGFULL "-g -Ob0 -noalign")
endif(CMAKE_C_COMPILER MATCHES "icc")
-
--
1.6.4.4
--
regards
MM
More information about the poppler
mailing list