Commit e09c1895 authored by GILLES Sebastien's avatar GILLES Sebastien

#1341 CMake: propagate properly compilation definitions to external projects.

parent 72ffa4ea
......@@ -10,19 +10,26 @@ if (NOT OPEN_MPI_LIB_DIR)
message(FATAL_ERROR "OPEN_MPI_LIB_DIR was not found; the recommended way to build MoReFEM is to provide a setting file that provide many cache values with -C, e.g. cmake -C ../cmake/Settings/clang_shared_lib.cmake.")
endif()
if(MOREFEM_NO_TRAP_SNES_EXCEPTION)
message("Adding flag MOREFEM_NO_TRAP_SNES_EXCEPTION")
add_definitions(-DMOREFEM_NO_TRAP_SNES_EXCEPTION)
endif()
if(MOREFEM_CHECK_UPDATE_GHOSTS_CALL_RELEVANCE)
message("ADDING FLAG MOREFEM_CHECK_UPDATE_GHOSTS_CALL_RELEVANCE")
message("Adding flag MOREFEM_CHECK_UPDATE_GHOSTS_CALL_RELEVANCE")
add_definitions(-DMOREFEM_CHECK_UPDATE_GHOSTS_CALL_RELEVANCE)
endif()
if(MOREFEM_EXTENDED_TIME_KEEP)
message("ADDING FLAG MOREFEM_EXTENDED_TIME_KEEP")
message("Adding flag MOREFEM_EXTENDED_TIME_KEEP")
add_definitions(-DMOREFEM_EXTENDED_TIME_KEEP)
endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
get_property(MOREFEM_COMPILE_DEFINITIONS DIRECTORY PROPERTY COMPILE_DEFINITIONS)
# TODO SHould disappear (in compiler...)
# From http://cmake.3232098.n2.nabble.com/Default-value-for-CMAKE-BUILD-TYPE-td7550756.html#a7550797
......
......@@ -106,6 +106,9 @@ target_include_directories(morefem_cmake INTERFACE $<BUILD_INTERFACE:${CMAKE_CUR
$<INSTALL_INTERFACE:${PROJECT_NAME}/include>)
target_link_libraries(morefem_cmake INTERFACE ${MOREFEM_POST_PROCESSING} ${MOREFEM_TEST_TOOLS})
set_property(TARGET morefem_cmake PROPERTY INTERFACE_COMPILE_DEFINITIONS ${MOREFEM_COMPILE_DEFINITIONS})
# #
#
......@@ -130,10 +133,9 @@ configure_package_config_file(../cmake/${PROJECT_NAME}Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${MOREFEM_INSTALL_DIR_CMAKE})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
DESTINATION ${MOREFEM_INSTALL_DIR_CMAKE})
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/../../cmake/CustomCommands.cmake
${CMAKE_CURRENT_BINARY_DIR}/../../cmake/MoReFEMSettings.cmake
DESTINATION ${MOREFEM_INSTALL_DIR_CMAKE})
......
......@@ -11,5 +11,11 @@
if(NOT TARGET @PROJECT_NAME@)
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
get_target_property(@PROJECT_NAME@_INCLUDE_DIRS morefem_cmake INTERFACE_INCLUDE_DIRECTORIES)
include("${CMAKE_CURRENT_LIST_DIR}/CustomCommands.cmake")
get_target_property(@PROJECT_NAME@_COMPILE_DEFINITION morefem_cmake INTERFACE_COMPILE_DEFINITIONS)
foreach(item ${MoReFEM_COMPILE_DEFINITION})
add_definitions(-D${item})
endforeach()
include("${CMAKE_CURRENT_LIST_DIR}/CustomCommands.cmake")
endif()
\ No newline at end of file
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