summaryrefslogtreecommitdiffstats
path: root/config/cmake/HDFCompilerFlags.cmake
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-04-05 18:38:04 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-04-05 18:38:04 (GMT)
commit2c2627e7f66ae9a7c333ad250101f97ae65178ab (patch)
tree49e2c4a387fb45f10d968d9e5fea4c9f4534a0fa /config/cmake/HDFCompilerFlags.cmake
parent70495751c05c4471be3a55b0e933e4d1e73d79c5 (diff)
downloadhdf5-2c2627e7f66ae9a7c333ad250101f97ae65178ab.zip
hdf5-2c2627e7f66ae9a7c333ad250101f97ae65178ab.tar.gz
hdf5-2c2627e7f66ae9a7c333ad250101f97ae65178ab.tar.bz2
Flag construction must be after compiler detection
Diffstat (limited to 'config/cmake/HDFCompilerFlags.cmake')
-rw-r--r--config/cmake/HDFCompilerFlags.cmake68
1 files changed, 0 insertions, 68 deletions
diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake
index 79e2bd2..1e5f775 100644
--- a/config/cmake/HDFCompilerFlags.cmake
+++ b/config/cmake/HDFCompilerFlags.cmake
@@ -133,9 +133,6 @@ if (NOT MSVC)
elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU")
ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/general")
message (STATUS "CMAKE_C_FLAGS_GENERAL=${HDF5_CMAKE_C_FLAGS}")
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-general")
- endif ()
ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-general")
# gcc automatically inlines based on the optimization level
# this is just a failsafe
@@ -290,24 +287,13 @@ if (HDF5_ENABLE_ALL_WARNINGS)
if (HDF5_ENABLE_DEV_WARNINGS)
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
list (APPEND HDF5_CMAKE_C_FLAGS "/Wall /wd4668")
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
- list (APPEND HDF5_CMAKE_CXX_FLAGS "/Wall /wd4668")
- endif ()
else ()
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
list (APPEND HDF5_CMAKE_C_FLAGS "/W3")
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
- list (APPEND HDF5_CMAKE_CXX_FLAGS "/W3")
- endif ()
endif ()
else ()
if (CMAKE_COMPILER_IS_GNUCC)
list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS0} ${H5_CFLAGS1} ${H5_CFLAGS2} ${H5_CFLAGS3} ${H5_CFLAGS4})
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CFLAGS0} ${H5_CFLAGS1} ${H5_CFLAGS2} ${H5_CFLAGS3} ${H5_CFLAGS4})
- endif ()
endif ()
endif ()
endif ()
@@ -321,16 +307,9 @@ if (HDF5_ENABLE_GROUPZERO_WARNINGS)
if (MSVC)
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}")
list (APPEND HDF5_CMAKE_C_FLAGS "/W1")
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}")
- list (APPEND HDF5_CMAKE_CXX_FLAGS "/W1")
- endif ()
else ()
if (CMAKE_COMPILER_IS_GNUCC)
list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS0})
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CFLAGS0})
- endif ()
endif ()
endif ()
endif ()
@@ -344,16 +323,9 @@ if (HDF5_ENABLE_GROUPONE_WARNINGS)
if (MSVC)
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}")
list (APPEND HDF5_CMAKE_C_FLAGS "/W2")
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}")
- list (APPEND HDF5_CMAKE_CXX_FLAGS "/W2")
- endif ()
else ()
if (CMAKE_COMPILER_IS_GNUCC)
list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS1})
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CFLAGS1})
- endif ()
endif ()
endif ()
endif ()
@@ -367,16 +339,9 @@ if (HDF5_ENABLE_GROUPTWO_WARNINGS)
if (MSVC)
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}")
list (APPEND HDF5_CMAKE_C_FLAGS "/W3")
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}")
- list (APPEND HDF5_CMAKE_CXX_FLAGS "/W3")
- endif ()
else ()
if (CMAKE_COMPILER_IS_GNUCC)
list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS2})
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CFLAGS2})
- endif ()
endif ()
endif ()
endif ()
@@ -390,16 +355,9 @@ if (HDF5_ENABLE_GROUPTHREE_WARNINGS)
if (MSVC)
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}")
list (APPEND HDF5_CMAKE_C_FLAGS "/W4")
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}")
- list (APPEND HDF5_CMAKE_CXX_FLAGS "/W4")
- endif ()
else ()
if (CMAKE_COMPILER_IS_GNUCC)
list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS3})
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CFLAGS3})
- endif ()
endif ()
endif ()
endif ()
@@ -413,9 +371,6 @@ if (HDF5_ENABLE_GROUPFOUR_WARNINGS)
if (NOT MSVC)
if (CMAKE_COMPILER_IS_GNUCC)
list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS4})
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CFLAGS4})
- endif ()
endif ()
endif ()
endif ()
@@ -427,9 +382,6 @@ endif ()
if (CMAKE_COMPILER_IS_GNUCC)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0")
endif ()
-if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0")
-endif ()
#-----------------------------------------------------------------------------
# Option for --enable-asserts
@@ -459,26 +411,12 @@ if (HDF5_ENABLE_SYMBOLS MATCHES "YES")
elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -fno-omit-frame-pointer")
endif ()
- if(CMAKE_CXX_COMPILER_LOADED)
- if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
- elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
- endif ()
- endif ()
elseif (HDF5_ENABLE_SYMBOLS MATCHES "NO")
if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-s")
elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s")
endif ()
- if(CMAKE_CXX_COMPILER_LOADED)
- if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
- set (CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wl,-s")
- elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s")
- endif ()
- endif ()
endif ()
MARK_AS_ADVANCED (HDF5_ENABLE_SYMBOLS)
@@ -489,9 +427,6 @@ MARK_AS_ADVANCED (HDF5_ENABLE_SYMBOLS)
option (HDF5_ENABLE_PROFILING "Enable profiling flags independently from the build mode." OFF)
if (HDF5_ENABLE_PROFILING)
list (APPEND HDF5_CMAKE_C_FLAGS "${PROFILE_CFLAGS}")
- if(CMAKE_CXX_COMPILER_LOADED)
- list (APPEND HDF5_CMAKE_CXX_FLAGS "${PROFILE_CXXFLAGS}")
- endif ()
endif ()
MARK_AS_ADVANCED (HDF5_ENABLE_PROFILING)
@@ -502,8 +437,5 @@ MARK_AS_ADVANCED (HDF5_ENABLE_PROFILING)
option (HDF5_ENABLE_OPTIMIZATION "Enable optimization flags/settings independently from the build mode" OFF)
if (HDF5_ENABLE_OPTIMIZATION)
list (APPEND HDF5_CMAKE_C_FLAGS "${OPTIMIZE_CFLAGS}")
- if(CMAKE_CXX_COMPILER_LOADED)
- list (APPEND HDF5_CMAKE_CXX_FLAGS "${OPTIMIZE_CXXFLAGS}")
- endif ()
endif ()
MARK_AS_ADVANCED (HDF5_ENABLE_OPTIMIZATION)