Skip to content

Commit 2134914

Browse files
committed
Cleanup the H5MATCH_TYPES_COMPILER
1 parent ad23ff3 commit 2134914

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

fortran/src/CMakeLists.txt

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -127,20 +127,18 @@ if (BUILD_STATIC_LIBS)
127127
endif ()
128128

129129
#-----------------------------------------------------------------------------
130-
if(CMAKE_CROSSCOMPILING AND CMAKE_C_COMPILER_FOR_BUILD)
131-
add_executable (H5match_types
132-
${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h
133-
${HDF5_F90_SRC_SOURCE_DIR}/H5match_types.c
134-
)
135-
set_target_properties(H5match_types PROPERTIES
136-
C_COMPILER ${CMAKE_C_COMPILER_FOR_BUILD}
137-
)
138-
message(STATUS "Using build compiler ${CMAKE_C_COMPILER_FOR_BUILD} for H5match_types")
139-
else()
140-
add_executable (H5match_types
141-
${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h
142-
${HDF5_F90_SRC_SOURCE_DIR}/H5match_types.c
143-
)
130+
add_executable (H5match_types
131+
${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h
132+
${HDF5_F90_SRC_SOURCE_DIR}/H5match_types.c
133+
)
134+
if(CMAKE_CROSSCOMPILING)
135+
set(H5MATCH_TYPES_COMPILER "$ENV{H5MATCH_TYPES_COMPILER}" CACHE STRING "compiler for build system")
136+
if (H5MATCH_TYPES_COMPILER)
137+
set_target_properties(H5match_types PROPERTIES
138+
C_COMPILER ${H5MATCH_TYPES_COMPILER}
139+
)
140+
message(STATUS "Using build compiler ${H5MATCH_TYPES_COMPILER} for H5match_types")
141+
endif()
144142
endif()
145143
target_include_directories (H5match_types PRIVATE "${HDF5_SRC_BINARY_DIR};${HDF5_SRC_INCLUDE_DIRS};${HDF5_F90_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
146144

0 commit comments

Comments
 (0)