IF(NOT DEAL_II_PROJECT_CONFIG_INCLUDED)
MESSAGE(FATAL_ERROR
- "DEAL_II_SETUP_TARGET can only be called in external projects after "
+ "\nDEAL_II_SETUP_TARGET can only be called in external projects after "
"the inclusion of deal.IIConfig.cmake. It is not intended for "
- "internal use."
+ "internal use.\n\n"
)
ENDIF()
INCLUDE(${DEAL_II_TARGET_CONFIG})
#
- # Fixup the CONFIGURATION types for debug and release targets:
+ # Setup a ${DEAL_II_BASE_NAME} target and populate it with our
#
- FOREACH(build ${DEAL_II_BUILD_TYPES})
- SET_TARGET_PROPERTIES(${DEAL_II_TARGET_${build}}
- PROPERTIES
- MAP_IMPORTED_CONFIG ${build}
- )
- ENDFOREACH()
ENDMACRO()
# DEAL_II_SETUP_TARGET(target)
#
# This sets the necessary include directories, linker flags, compile
-# definitions and the external libraries the target will be linked against.
+# definitions and the deal.II library the target will be linked against.
#
#
IF(NOT DEAL_II_PROJECT_CONFIG_INCLUDED)
MESSAGE(FATAL_ERROR
- "DEAL_II_SETUP_TARGET can only be called in external projects after "
+ "\nDEAL_II_SETUP_TARGET can only be called in external projects after "
"the inclusion of deal.IIConfig.cmake. It is not intended for "
- "internal use."
+ "internal use.\n\n"
)
ENDIF()
"${DEAL_II_USER_DEFINITIONS}"
)
- # TODO: A bit more magic...
+ #
+ # Set build type dependend flags and definitions:
+ #
FOREACH(build ${DEAL_II_BUILD_TYPES})
- IF(CMAKE_BUILD_TYPE MATCHES "${build}")
- SET_TARGET_PROPERTIES(${target} PROPERTIES
- LINK_FLAGS_${CMAKE_BUILD_TYPE}
- "${DEAL_II_LINKER_FLAGS_${build}}"
- COMPILE_DEFINITIONS_${CMAKE_BUILD_TYPE}
- "${DEAL_II_USER_DEFINITIONS_${build}}"
- )
- TARGET_LINK_LIBRARIES(${target}
- ${DEAL_II_TARGET_${build}}
- )
- RETURN()
- ENDIF()
+ SET_TARGET_PROPERTIES(${target} PROPERTIES
+ LINK_FLAGS_${build}
+ "${DEAL_II_LINKER_FLAGS_${build}}"
+ COMPILE_DEFINITIONS_${build}
+ "${DEAL_II_USER_DEFINITIONS_${build}}"
+ )
+
ENDFOREACH()
+ #
+ # Link againgst the correct deal.II library target for the current
+ # CMAKE_BUILD_TYPE:
+ #
+ STRING(TOUPPER "${CMAKE_BUILD_TYPE}" build)
+ IF(NOT "${DEAL_II_TARGET_${build}}" STREQUAL "")
+ TARGET_LINK_LIBRARIES(${target}
+ ${DEAL_II_TARGET_${build}}
+ )
+ ELSE()
+ MESSAGE(FATAL_ERROR
+ "\nNo matching deal.II library target for current build type: "
+ "\"${CMAKE_BUILD_TYPE}\"\n"
+ "Candidates are (case insensitive): ${DEAL_II_BUILD_TYPES}\n\n"
+ )
+ ENDIF()
+
ENDMACRO()
ENDFOREACH()
#
-# Append the feature configuration:
+# Append feature configuration:
#
FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake
"\n\n#\n# Feature configuration:\n#\n\n"
ENDFOREACH()
#
-# Include the convenience macros directly at the end of our project
-# config:
+# Include convenience macros directly at the end of our project config:
#
FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake
"\n\n#\n# Include some convenience macros directly in the project config:\n#\n\n"