Merge branch 'Cmake-write-file-list' into 'development'

save list of files used for compilation

See merge request damask/DAMASK!443
This commit is contained in:
Daniel Otto de Mentock 2021-10-22 10:16:55 +00:00
commit 5995a78773
2 changed files with 105 additions and 106 deletions

View File

@ -13,24 +13,23 @@ 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(${executable-name} OBJECT ${damask-sources} ${solver-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") string(REPLACE ";" "\n" sources "${damask-sources};${solver-sources}")
message(${CMAKE_BINARY_DIR})
file(GLOB mesh-sources CONFIGURE_DEPENDS mesh/*.f90) file(WRITE ${CMAKE_BINARY_DIR}/sources.txt ${sources})
add_executable(DAMASK_mesh ${damask-sources} ${mesh-sources})
install (TARGETS DAMASK_mesh RUNTIME DESTINATION bin)
endif ()