summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2011-11-30 20:28:47 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2011-11-30 20:28:47 (GMT)
commit32f91a685b1770db49d6deda541c52f64665950c (patch)
treec5cfd075770034975538578d893862a2f036787a /CMakeLists.txt
parent49652319c98725734d9bf0577a2905082baa6cf8 (diff)
downloadhdf5-32f91a685b1770db49d6deda541c52f64665950c.zip
hdf5-32f91a685b1770db49d6deda541c52f64665950c.tar.gz
hdf5-32f91a685b1770db49d6deda541c52f64665950c.tar.bz2
[svn-r21783] Correct macros for building static libs on linux when CMAKE_BUILD_TYPE is defined.
Also correct use of CMAKE_ANSI_FLAGS for passing into sub-projects.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt24
1 files changed, 11 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1dbf756..24fa738 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -297,17 +297,6 @@ IF (BUILD_STATIC_EXECS)
ENDIF (BUILD_STATIC_EXECS)
#-----------------------------------------------------------------------------
-# Option to Build Static PIC
-#-----------------------------------------------------------------------------
-OPTION (BUILD_STATIC_PIC "Build Static PIC" OFF)
-IF (BUILD_STATIC_PIC)
- IF (NOT WIN32)
- SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
- SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
- ENDIF (NOT WIN32)
-ENDIF (BUILD_STATIC_PIC)
-
-#-----------------------------------------------------------------------------
# Option to use code coverage
#-----------------------------------------------------------------------------
OPTION (HDF5_ENABLE_COVERAGE "Enable code coverage for Libraries and Programs" OFF)
@@ -402,6 +391,13 @@ IF (CMAKE_COMPILER_IS_GNUCC)
SET (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99 -fomit-frame-pointer -finline-functions -fno-common")
ENDIF (CMAKE_BUILD_TYPE MATCHES Debug)
ENDIF (CMAKE_COMPILER_IS_GNUCC)
+IF (CMAKE_COMPILER_IS_GNUCXX)
+ IF (CMAKE_BUILD_TYPE MATCHES Debug)
+ SET (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS} -finline-functions -fno-common")
+ ELSE (CMAKE_BUILD_TYPE MATCHES Debug)
+ SET (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS} -fomit-frame-pointer -finline-functions -fno-common")
+ ENDIF (CMAKE_BUILD_TYPE MATCHES Debug)
+ENDIF (CMAKE_COMPILER_IS_GNUCXX)
#-----------------------------------------------------------------------------
# Option to embed library info into executables
@@ -420,9 +416,10 @@ IF (HDF5_DISABLE_COMPILER_WARNINGS)
# warning level is given, so remove it.
IF (MSVC)
SET (HDF5_WARNINGS_BLOCKED 1)
- STRING (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " "
- CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
+ STRING (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /w")
+ STRING (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+ SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /w")
ENDIF (MSVC)
IF (WIN32 AND NOT CYGWIN)
ADD_DEFINITIONS (-D_CRT_SECURE_NO_WARNINGS)
@@ -436,6 +433,7 @@ IF (HDF5_DISABLE_COMPILER_WARNINGS)
# Most compilers use -w to suppress warnings.
IF (NOT HDF5_WARNINGS_BLOCKED)
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
+ SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
ENDIF (NOT HDF5_WARNINGS_BLOCKED)
ENDIF (HDF5_DISABLE_COMPILER_WARNINGS)