Skip to content

Commit ac3de3d

Browse files
committed
Fix LIBOMP_COPY_EXPORTS
1 parent 36a6a8b commit ac3de3d

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

openmp/runtime/cmake/LibompExports.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,15 @@ if(${LIBOMP_OMPT_SUPPORT})
6565
)
6666
endif()
6767
if(${LIBOMP_FORTRAN_MODULES})
68-
add_custom_command(TARGET libomp-mod POST_BUILD
68+
# libomp-mod is an OBJECT library which does not have a POST_BUILD command.
69+
# attach it to omp instead an ensure libomp-mod is built before.
70+
add_custom_command(TARGET omp POST_BUILD
6971
COMMAND ${CMAKE_COMMAND} -E make_directory ${LIBOMP_EXPORTS_MOD_DIR}
7072
COMMAND ${CMAKE_COMMAND} -E copy omp_lib.mod ${LIBOMP_EXPORTS_MOD_DIR}
7173
COMMAND ${CMAKE_COMMAND} -E copy omp_lib_kinds.mod ${LIBOMP_EXPORTS_MOD_DIR}
7274
)
75+
add_dependencies(omp libomp-mod)
76+
7377
add_custom_command(TARGET omp POST_BUILD
7478
COMMAND ${CMAKE_COMMAND} -E copy omp_lib.h ${LIBOMP_EXPORTS_CMN_DIR}
7579
)

openmp/runtime/src/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -388,11 +388,6 @@ endif()
388388
configure_file(${LIBOMP_INC_DIR}/omp_lib.h.var omp_lib.h @ONLY)
389389
configure_file(${LIBOMP_INC_DIR}/omp_lib.F90.var omp_lib.F90 @ONLY)
390390

391-
# Move files to exports/ directory if requested
392-
if(${LIBOMP_COPY_EXPORTS})
393-
include(LibompExports)
394-
endif()
395-
396391
# Micro test rules for after library has been built (cmake/LibompMicroTests.cmake)
397392
include(LibompMicroTests)
398393
add_custom_target(libomp-micro-tests)
@@ -516,3 +511,8 @@ if(LIBOMP_FORTRAN_MODULES)
516511
DESTINATION ${DEVEL_PACKAGE}${destination}
517512
)
518513
endif()
514+
515+
# Move files to exports/ directory if requested
516+
if(${LIBOMP_COPY_EXPORTS})
517+
include(LibompExports)
518+
endif()

0 commit comments

Comments
 (0)