mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-24 22:27:55 -05:00
Drop implicit include dirs from per-file HDF5 include property
A system HDF5 reports /usr/include. CMake filters implicit dirs from target include directories but not from the source-file INCLUDE_DIRECTORIES property, so -I/usr/include reached the command line and broke #include_next <math.h> in <cmath> on gcc-toolset.
This commit is contained in:
1 parent
8604b2e290
commit
a94358cc0d
2 files changed
+12
-1
No files matched your search
@@ -237,6 +237,12 @@ if(RESINSIGHT_FOUND_HDF5)
|
||||
set(RI_HDF5_INCLUDE_DIRS ${RESINSIGHT_HDF5_DIR}/include)
|
||||
else()
|
||||
set(RI_HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIRS})
|
||||
# A system HDF5 reports /usr/include. CMake does not filter implicit dirs
|
||||
# from the source-file property, and an explicit -I/usr/include breaks
|
||||
# #include_next <math.h> in <cmath> on gcc-toolset.
|
||||
list(REMOVE_ITEM RI_HDF5_INCLUDE_DIRS
|
||||
${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}
|
||||
)
|
||||
endif() # MSVC
|
||||
|
||||
# Only these files (and HDF5_FILES) include HDF5 headers directly, so scope
|
||||
|
||||
@@ -292,9 +292,14 @@ if(RESINSIGHT_FOUND_HDF5)
|
||||
${RESINSIGHT_HDF5_DIR}/include
|
||||
)
|
||||
else()
|
||||
# Drop implicit dirs such as /usr/include, see ApplicationLibCode.
|
||||
set(RI_HDF5_TEST_INCLUDE_DIRS ${HDF5_INCLUDE_DIRS})
|
||||
list(REMOVE_ITEM RI_HDF5_TEST_INCLUDE_DIRS
|
||||
${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}
|
||||
)
|
||||
set_source_files_properties(
|
||||
${RI_HDF5_TEST_FILES} PROPERTIES INCLUDE_DIRECTORIES
|
||||
"${HDF5_INCLUDE_DIRS}"
|
||||
"${RI_HDF5_TEST_INCLUDE_DIRS}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
Reference in new issue
Block a user