diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2011-11-30 20:28:47 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2011-11-30 20:28:47 (GMT) |
commit | 32f91a685b1770db49d6deda541c52f64665950c (patch) | |
tree | c5cfd075770034975538578d893862a2f036787a | |
parent | 49652319c98725734d9bf0577a2905082baa6cf8 (diff) | |
download | hdf5-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.
-rw-r--r-- | CMakeLists.txt | 24 | ||||
-rw-r--r-- | config/cmake/HDFMacros.cmake | 8 |
2 files changed, 17 insertions, 15 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) diff --git a/config/cmake/HDFMacros.cmake b/config/cmake/HDFMacros.cmake index b0a6dfc..5f397fc 100644 --- a/config/cmake/HDFMacros.cmake +++ b/config/cmake/HDFMacros.cmake @@ -21,7 +21,7 @@ MACRO (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} - -DCMAKE_ANSI_CFLAGS:STRING="${jpeg_pic}" + -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic} ) ELSEIF (${compress_type} MATCHES "TGZ") EXTERNALPROJECT_ADD (JPEG @@ -36,7 +36,7 @@ MACRO (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} - -DCMAKE_ANSI_CFLAGS:STRING="${jpeg_pic}" + -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic} ) ENDIF (${compress_type} MATCHES "SVN") EXTERNALPROJECT_GET_PROPERTY (JPEG BINARY_DIR SOURCE_DIR) @@ -119,6 +119,7 @@ MACRO (EXTERNAL_SZIP_LIBRARY compress_type libtype encoding) -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} + -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DSZIP_ENABLE_ENCODING:BOOL=${encoding} ) ELSEIF (${compress_type} MATCHES "TGZ") @@ -134,6 +135,7 @@ MACRO (EXTERNAL_SZIP_LIBRARY compress_type libtype encoding) -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} + -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DSZIP_ENABLE_ENCODING:BOOL=${encoding} ) ENDIF (${compress_type} MATCHES "SVN") @@ -217,6 +219,7 @@ MACRO (EXTERNAL_ZLIB_LIBRARY compress_type libtype) -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} + -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DHDF_LEGACY_NAMING:BOOL=${HDF_LEGACY_NAMING} ) ELSEIF (${compress_type} MATCHES "TGZ") @@ -232,6 +235,7 @@ MACRO (EXTERNAL_ZLIB_LIBRARY compress_type libtype) -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} + -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DHDF_LEGACY_NAMING:BOOL=${HDF_LEGACY_NAMING} ) ENDIF (${compress_type} MATCHES "SVN") |