From 9eea7ec2c4a0d4620c43edafa9da30488c536aa4 Mon Sep 17 00:00:00 2001 From: Algiane Froehly Date: Tue, 13 Dec 2022 09:52:19 +0100 Subject: [PATCH] Fix issue with fortran headers installation when perls is not found [skip ci]. --- cmake/modules/mmg.cmake | 27 ++++++++++++++++++--------- cmake/modules/mmg2d.cmake | 5 ++++- cmake/modules/mmg3d.cmake | 5 ++++- cmake/modules/mmgcommon.cmake | 7 +++++-- cmake/modules/mmgs.cmake | 5 ++++- 5 files changed, 35 insertions(+), 14 deletions(-) diff --git a/cmake/modules/mmg.cmake b/cmake/modules/mmg.cmake index 709ab1cdf..f050f0651 100644 --- a/cmake/modules/mmg.cmake +++ b/cmake/modules/mmg.cmake @@ -89,23 +89,28 @@ IF ( LIBMMG_STATIC OR LIBMMG_SHARED ) SET( mmg2d_headers ${MMG2D_SOURCE_DIR}/mmg2d_export.h ${MMG2D_SOURCE_DIR}/libmmg2d.h - ${MMG2D_BINARY_DIR}/libmmg2df.h ) SET( mmg3d_headers ${MMG3D_SOURCE_DIR}/mmg3d_export.h ${MMG3D_SOURCE_DIR}/libmmg3d.h - ${MMG3D_BINARY_DIR}/libmmg3df.h ) SET( mmgs_headers ${MMGS_SOURCE_DIR}/mmgs_export.h ${MMGS_SOURCE_DIR}/libmmgs.h - ${MMGS_BINARY_DIR}/libmmgsf.h ) SET( mmg_headers # ${PROJECT_SOURCE_DIR}/src/common/mmg_core_export.h - ${PROJECT_SOURCE_DIR}/src/mmg/libmmg.h - ${PROJECT_SOURCE_DIR}/src/mmg/libmmgf.h + ${PROJECT_SOURCE_DIR}/src/mmg/libmmg.h ) + + IF ( PERL_FOUND ) + LIST ( APPEND mmg3d_headers ${MMG3D_BINARY_DIR}/libmmg3df.h ) + LIST ( APPEND mmg2d_headers ${MMG2D_BINARY_DIR}/libmmg2df.h ) + LIST ( APPEND mmgs_headers ${MMGS_BINARY_DIR}/libmmgsf.h ) + LIST ( APPEND mmg_headers ${PROJECT_SOURCE_DIR}/libmmgf.h ) + ENDIF() + + SET(MMG2D_INCLUDE ${PROJECT_BINARY_DIR}/include/mmg/mmg2d ) SET(MMGS_INCLUDE ${PROJECT_BINARY_DIR}/include/mmg/mmgs ) SET(MMG3D_INCLUDE ${PROJECT_BINARY_DIR}/include/mmg/mmg3d ) @@ -122,7 +127,9 @@ IF ( LIBMMG_STATIC OR LIBMMG_SHARED ) INSTALL(FILES ${mmg3d_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mmg/mmg3d) INSTALL(FILES ${mmg_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mmg) - FILE(INSTALL ${PROJECT_SOURCE_DIR}/src/mmg/libmmgf.h DESTINATION ${PROJECT_BINARY_DIR}/include/mmg/) + IF ( PERL_FOUND ) + FILE(INSTALL ${PROJECT_SOURCE_DIR}/src/mmg/libmmgf.h DESTINATION ${PROJECT_BINARY_DIR}/include/mmg/) + ENDIF() # Install header files in project directory FILE(INSTALL ${mmg2d_headers} @@ -138,12 +145,14 @@ IF ( LIBMMG_STATIC OR LIBMMG_SHARED ) DESTINATION ${PROJECT_BINARY_DIR}/include/mmg/ PATTERN "libmmg*f.h" EXCLUDE) + set ( mmg_tgt_list ${PROJECT_BINARY_DIR}/include/mmg/libmmg.h ) + IF ( PERL_FOUND ) + list ( APPEND mmg_tgt_list ${PROJECT_BINARY_DIR}/include/mmg/libmmgf.h) + ENDIF( ) ADD_CUSTOM_TARGET(copy_mmg_headers ALL DEPENDS - copy_2d_headers copy_s_headers copy_3d_headers - ${PROJECT_BINARY_DIR}/include/mmg/libmmgf.h - ${PROJECT_BINARY_DIR}/include/mmg/libmmg.h + copy_2d_headers copy_s_headers copy_3d_headers mmg_tgt_lit ) ENDIF() diff --git a/cmake/modules/mmg2d.cmake b/cmake/modules/mmg2d.cmake index b4c6b1e8c..87ad8afc8 100644 --- a/cmake/modules/mmg2d.cmake +++ b/cmake/modules/mmg2d.cmake @@ -117,9 +117,12 @@ ENDIF ( ) SET( mmg2d_headers ${MMG2D_SOURCE_DIR}/mmg2d_export.h ${MMG2D_SOURCE_DIR}/libmmg2d.h - ${MMG2D_BINARY_DIR}/libmmg2df.h ) +IF ( PERL_FOUND ) + LIST ( APPEND mmg2d_headers ${MMG2D_BINARY_DIR}/libmmg2df.h ) +ENDIF() + IF ( MMG_INSTALL_PRIVATE_HEADERS ) LIST ( APPEND mmg2d_headers ${MMG2D_SOURCE_DIR}/libmmg2d_private.h diff --git a/cmake/modules/mmg3d.cmake b/cmake/modules/mmg3d.cmake index 0adab9aa7..0fc1677cf 100644 --- a/cmake/modules/mmg3d.cmake +++ b/cmake/modules/mmg3d.cmake @@ -144,9 +144,12 @@ ENDIF() SET( mmg3d_headers ${MMG3D_SOURCE_DIR}/mmg3d_export.h ${MMG3D_SOURCE_DIR}/libmmg3d.h - ${MMG3D_BINARY_DIR}/libmmg3df.h ) +IF ( PERL_FOUND ) + LIST ( APPEND mmg3d_headers ${MMG3D_BINARY_DIR}/libmmg3df.h ) +ENDIF() + IF ( MMG_INSTALL_PRIVATE_HEADERS ) LIST ( APPEND mmg3d_headers ${MMG3D_SOURCE_DIR}/libmmg3d_private.h diff --git a/cmake/modules/mmgcommon.cmake b/cmake/modules/mmgcommon.cmake index 9cac9fa4e..e1bf5a3e4 100644 --- a/cmake/modules/mmgcommon.cmake +++ b/cmake/modules/mmgcommon.cmake @@ -47,11 +47,15 @@ SET(MMGCOMMON_INCLUDE ${PROJECT_BINARY_DIR}/include/${MMGCOMMON_SHRT_INC SET( mmgcommon_headers ${MMGCOMMON_SOURCE_DIR}/mmg_export.h ${MMGCOMMON_SOURCE_DIR}/libmmgtypes.h - ${MMGCOMMON_BINARY_DIR}/libmmgtypesf.h ${MMGCOMMON_BINARY_DIR}/mmgcmakedefines.h ${MMGCOMMON_BINARY_DIR}/mmgcmakedefinesf.h ${MMGCOMMON_BINARY_DIR}/mmgversion.h ) + +IF ( PERL_FOUND ) + LIST ( APPEND mmgcommon_headers ${MMGCOMMON_BINARY_DIR}/libmmgtypesf.h ) +ENDIF ( ) + IF ( MMG_INSTALL_PRIVATE_HEADERS ) LIST ( APPEND mmgcommon_headers ${MMGCOMMON_SOURCE_DIR}/libmmgcommon_private.h @@ -66,7 +70,6 @@ IF ( MMG_INSTALL_PRIVATE_HEADERS ) ) ENDIF() - IF (NOT WIN32 OR MINGW) LIST(APPEND mmgcommon_headers ${MMGCOMMON_BINARY_DIR}/git_log_mmg.h ) ENDIF() diff --git a/cmake/modules/mmgs.cmake b/cmake/modules/mmgs.cmake index bc8957fc6..f72161526 100644 --- a/cmake/modules/mmgs.cmake +++ b/cmake/modules/mmgs.cmake @@ -109,9 +109,12 @@ ENDIF() SET( mmgs_headers ${MMGS_SOURCE_DIR}/mmgs_export.h ${MMGS_SOURCE_DIR}/libmmgs.h - ${MMGS_BINARY_DIR}/libmmgsf.h ) +IF ( PERL_FOUND ) + LIST ( APPEND mmgs_headers ${MMGS_BINARY_DIR}/libmmgsf.h ) +ENDIF() + IF ( MMG_INSTALL_PRIVATE_HEADERS ) LIST ( APPEND mmgs_headers ${MMGS_SOURCE_DIR}/libmmgs_private.h