cleaner code that also works with older cmake

This commit is contained in:
Martin Diehl 2019-04-26 17:39:21 +02:00
parent ed2d64d876
commit b63a6c7034
2 changed files with 6 additions and 14 deletions

View File

@ -467,17 +467,4 @@ message ("Fortran Linker Command:\n${CMAKE_Fortran_LINK_EXECUTABLE}\n")
# location of code
add_subdirectory (src)
# INSTALL BUILT BINARIES
if (CMAKE_BUILD_TYPE STREQUAL "SYNTAXONLY")
exec_program (mktemp OUTPUT_VARIABLE nothing)
exec_program (mktemp ARGS -d OUTPUT_VARIABLE black_hole)
install (PROGRAMS ${nothing} DESTINATION ${black_hole})
else ()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if (PROJECT_NAME STREQUAL "damask-grid")
install (TARGETS DAMASK_spectral RUNTIME)
elseif (PROJECT_NAME STREQUAL "damask-mesh")
install (TARGETS DAMASK_FEM RUNTIME)
endif ()
endif ()

View File

@ -25,8 +25,12 @@ if (PROJECT_NAME STREQUAL "damask-grid")
if(NOT CMAKE_BUILD_TYPE STREQUAL "SYNTAXONLY")
add_executable(DAMASK_spectral ${sources})
install (TARGETS DAMASK_spectral RUNTIME)
else()
add_library(DAMASK_spectral OBJECT ${sources})
exec_program (mktemp OUTPUT_VARIABLE nothing)
exec_program (mktemp ARGS -d OUTPUT_VARIABLE black_hole)
install (PROGRAMS ${nothing} DESTINATION ${black_hole})
endif()
elseif (PROJECT_NAME STREQUAL "damask-mesh")
@ -42,5 +46,6 @@ elseif (PROJECT_NAME STREQUAL "damask-mesh")
list(FILTER sources EXCLUDE REGEX ".*mesh_grid.*\\.f90")
add_executable(DAMASK_FEM ${sources})
install (TARGETS DAMASK_FEM RUNTIME)
endif()