SYNTAXONLY for mesh, avoid code duplication

This commit is contained in:
Martin Diehl 2021-10-15 22:14:37 +02:00
parent dead46ebf6
commit c628c028dc
1 changed files with 17 additions and 22 deletions

View File

@ -13,24 +13,19 @@ list(FILTER damask-sources EXCLUDE REGEX ".*commercialFEM_fileList.*.f90")
if(PROJECT_NAME STREQUAL "damask-grid") if(PROJECT_NAME STREQUAL "damask-grid")
set(executable-name "DAMASK_grid")
file(GLOB grid-sources CONFIGURE_DEPENDS grid/*.f90) file(GLOB solver-sources CONFIGURE_DEPENDS grid/*.f90)
elseif(PROJECT_NAME STREQUAL "damask-mesh")
set(executable-name "DAMASK_mesh")
file(GLOB solver-sources CONFIGURE_DEPENDS mesh/*.f90)
endif()
if(NOT CMAKE_BUILD_TYPE STREQUAL "SYNTAXONLY") if(NOT CMAKE_BUILD_TYPE STREQUAL "SYNTAXONLY")
add_executable(DAMASK_grid ${damask-sources} ${grid-sources}) add_executable(${executable-name} ${damask-sources} ${solver-sources})
install (TARGETS DAMASK_grid RUNTIME DESTINATION bin) install(TARGETS ${executable-name} RUNTIME DESTINATION bin)
else() else()
add_library(DAMASK_grid OBJECT ${damask-sources} ${grid-sources}) add_library(DAMASK_grid OBJECT ${damask-sources} ${grid-sources})
exec_program(mktemp OUTPUT_VARIABLE nothing) exec_program(mktemp OUTPUT_VARIABLE nothing)
exec_program(mktemp ARGS -d OUTPUT_VARIABLE black_hole) exec_program(mktemp ARGS -d OUTPUT_VARIABLE black_hole)
install(PROGRAMS ${nothing} DESTINATION ${black_hole}) install(PROGRAMS ${nothing} DESTINATION ${black_hole})
endif() endif()
elseif (PROJECT_NAME STREQUAL "damask-mesh")
file(GLOB mesh-sources CONFIGURE_DEPENDS mesh/*.f90)
add_executable(DAMASK_mesh ${damask-sources} ${mesh-sources})
install (TARGETS DAMASK_mesh RUNTIME DESTINATION bin)
endif ()