From b63a6c703436a3fa810bf90dc96e69f52cc7b2a9 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 26 Apr 2019 17:39:21 +0200 Subject: [PATCH] cleaner code that also works with older cmake --- CMakeLists.txt | 15 +-------------- src/CMakeLists.txt | 5 +++++ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4601d0dfd..a9c5fa83e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 () +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8cdb51551..6ff120873 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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()