Commit 2a4c91a9 authored by GILLES Sebastien's avatar GILLES Sebastien

#1217 CMake: Minor improvements.

parent 51eb28e7
......@@ -70,7 +70,7 @@ set(CMAKE_CXX_EXTENSIONS OFF) # I want c++17, not gnu++17.
include(CustomCommands)
# All --all_load in target_link_libraries of executables if STATIC library are chose.
# All --all_load in target_link_libraries of executables if STATIC library are chosen.
if(LIBRARY_TYPE MATCHES STATIC)
set(ALL_LOAD_FLAG "-all_load")
......
......@@ -71,8 +71,6 @@ include(Test/CMakeLists.txt)
#get_property(core_sources TARGET ${MOREFEM_CORE} PROPERTY SOURCES)
#string(REPLACE "//" " /" core_sources ${core_sources})
message("LISTDIR " ${CMAKE_CURRENT_LIST_DIR})
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/ DESTINATION ${MOREFEM_INSTALL_DIR_INCL}
FILES_MATCHING PATTERN "*.hpp")
......
......@@ -68,6 +68,8 @@ endfunction()
# required at least for shared libraries on macOS.
# - Install the targets in the MoReFEM installation directories.
# ##########################################################################################
include(GenerateExportHeader)
function(morefem_install)
foreach(target ${ARGN})
......@@ -75,12 +77,18 @@ function(morefem_install)
if (target_type STREQUAL "EXECUTABLE")
# Additional step to make shared library work on macOS; see https://gist.github.com/robertmaynard/5750737
set_target_properties(${target} PROPERTIES INSTALL_RPATH "@loader_path/../lib")
elseif()
generate_export_header(${target})
endif ()
install(TARGETS ${target}
EXPORT "${target}TARGETS"
RUNTIME DESTINATION ${MOREFEM_INSTALL_DIR_EXE}
LIBRARY DESTINATION ${MOREFEM_INSTALL_DIR_LIB}
ARCHIVE DESTINATION ${MOREFEM_INSTALL_DIR_LIB})
ARCHIVE DESTINATION ${MOREFEM_INSTALL_DIR_LIB}
INCLUDES DESTINATION ${MOREFEM_INSTALL_DIR_INCL})
endforeach()
endfunction()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment