MACRO(DEAL_II_ADD_C_LIBRARY library)
- IF(CMAKE_BUILD_TYPE MATCHES "Debug")
- #
- # and a debug target
- #
- ADD_LIBRARY(${library}_debug
- ${ARGN}
- )
-
- SET_TARGET_PROPERTIES(${library}_debug PROPERTIES
- LINK_FLAGS "${DEAL_II_SHARED_LINKER_FLAGS_DEBUG}"
- COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_DEBUG}"
- COMPILE_FLAGS "${DEAL_II_C_FLAGS_DEBUG}"
- )
-
- FILE(APPEND
- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/deal_ii_objects_debug
- "$<TARGET_OBJECTS:${library}_debug>\n"
- )
- ENDIF()
+ FOREACH(build ${DEAL_II_BUILD_TYPES})
+ STRING(TOLOWER ${build} build_lowercase)
- IF(CMAKE_BUILD_TYPE MATCHES "Release")
- #
- # Add a release target
- #
- ADD_LIBRARY(${library}
+ ADD_LIBRARY(${library}.${build_lowercase}
${ARGN}
)
- SET_TARGET_PROPERTIES(${library} PROPERTIES
- LINK_FLAGS "${DEAL_II_SHARED_LINKER_FLAGS_RELEASE}"
- COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_RELEASE}"
- COMPILE_FLAGS "${DEAL_II_C_FLAGS_RELEASE}"
+ SET_TARGET_PROPERTIES(${library}.${build_lowercase} PROPERTIES
+ LINK_FLAGS "${DEAL_II_SHARED_LINKER_FLAGS_${build}}"
+ COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_${build}}"
+ COMPILE_FLAGS "${DEAL_II_C_FLAGS_${build}}"
)
FILE(APPEND
- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/deal_ii_objects
- "$<TARGET_OBJECTS:${library}>\n"
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/deal_ii_objects_${build_lowercase}
+ "$<TARGET_OBJECTS:${library}.${build_lowercase}>\n"
)
- ENDIF()
+ ENDFOREACH()
ENDMACRO()
MACRO(DEAL_II_ADD_DEFINITIONS name)
- IF(CMAKE_BUILD_TYPE MATCHES "Debug")
- GET_TARGET_PROPERTY(macro_definitions ${name}_debug COMPILE_DEFINITIONS)
- SET_TARGET_PROPERTIES(${name}_debug PROPERTIES
- COMPILE_DEFINITIONS "${ARGN};${macro_definitions}"
- )
- ENDIF()
+ FOREACH(build ${DEAL_II_BUILD_TYPES})
+ STRING(TOLOWER ${build} build_lowercase)
- IF(CMAKE_BUILD_TYPE MATCHES "Release")
- GET_TARGET_PROPERTY(macro_definitions ${name} COMPILE_DEFINITIONS)
- SET_TARGET_PROPERTIES(${name} PROPERTIES
+ GET_TARGET_PROPERTY(macro_definitions ${name}.${build_lowercase} COMPILE_DEFINITIONS)
+ SET_TARGET_PROPERTIES(${name}.${build_lowercase} PROPERTIES
COMPILE_DEFINITIONS "${ARGN};${macro_definitions}"
)
- ENDIF()
+ ENDFOREACH()
ENDMACRO()
MACRO(DEAL_II_ADD_DEPENDENCIES name target)
- IF(CMAKE_BUILD_TYPE MATCHES "Debug")
- ADD_DEPENDENCIES(${name}_debug ${target}_debug)
- ENDIF()
-
- IF(CMAKE_BUILD_TYPE MATCHES "Release")
- ADD_DEPENDENCIES(${name} ${target})
- ENDIF()
+ FOREACH(build ${DEAL_II_BUILD_TYPES})
+ STRING(TOLOWER ${build} build_lowercase)
+ ADD_DEPENDENCIES(${name}.${build_lowercase}
+ ${target}.${build_lowercase}
+ )
+ ENDFOREACH()
ENDMACRO()
MACRO(DEAL_II_ADD_LIBRARY library)
- IF(CMAKE_BUILD_TYPE MATCHES "Debug")
- #
- # and a debug target
- #
- ADD_LIBRARY(${library}_debug
- ${ARGN}
- )
-
- SET_TARGET_PROPERTIES(${library}_debug PROPERTIES
- LINK_FLAGS "${DEAL_II_SHARED_LINKER_FLAGS_DEBUG}"
- COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_DEBUG}"
- COMPILE_FLAGS "${DEAL_II_CXX_FLAGS_DEBUG}"
- )
-
- FILE(APPEND
- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/deal_ii_objects_debug
- "$<TARGET_OBJECTS:${library}_debug>\n"
- )
- ENDIF()
+ FOREACH(build ${DEAL_II_BUILD_TYPES})
+ STRING(TOLOWER ${build} build_lowercase)
- IF(CMAKE_BUILD_TYPE MATCHES "Release")
- #
- # Add a release target
- #
- ADD_LIBRARY(${library}
+ ADD_LIBRARY(${library}.${build_lowercase}
${ARGN}
)
- SET_TARGET_PROPERTIES(${library} PROPERTIES
- LINK_FLAGS "${DEAL_II_SHARED_LINKER_FLAGS_RELEASE}"
- COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_RELEASE}"
- COMPILE_FLAGS "${DEAL_II_CXX_FLAGS_RELEASE}"
+ SET_TARGET_PROPERTIES(${library}.${build_lowercase} PROPERTIES
+ LINK_FLAGS "${DEAL_II_SHARED_LINKER_FLAGS_${build}}"
+ COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_${build}}"
+ COMPILE_FLAGS "${DEAL_II_CXX_FLAGS_${build}}"
)
FILE(APPEND
- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/deal_ii_objects
- "$<TARGET_OBJECTS:${library}>\n"
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/deal_ii_objects_${build_lowercase}
+ "$<TARGET_OBJECTS:${library}.${build_lowercase}>\n"
)
- ENDIF()
+ ENDFOREACH()
ENDMACRO()
# Add a dependency to target so that target.inst is fully generated
# before target will be processed.
#
- IF(CMAKE_BUILD_TYPE MATCHES "Debug")
- ADD_DEPENDENCIES(${target}_debug ${target}.inst)
- ENDIF()
- IF(CMAKE_BUILD_TYPE MATCHES "Release")
- ADD_DEPENDENCIES(${target} ${target}.inst)
- ENDIF()
+ FOREACH(build ${DEAL_II_BUILD_TYPES})
+ STRING(TOLOWER ${build} build_lowercase)
+ ADD_DEPENDENCIES(${target}.${build_lowercase} ${target}.inst)
+ ENDFOREACH()
ENDMACRO()
# DEAL_II_PROJECT_CONFIG_NAME *)
# DEAL_II_BASE_NAME *)
# DEAL_II_DEBUG_SUFFIX *)
+# DEAL_II_RELEASE_SUFFIX *)
# DEAL_II_LIBRARY_NAME_DEBUG
# DEAL_II_LIBRARY_NAME_RELEASE
#
# DEAL_II_INCLUDE_DIRS
# DEAL_II_LIBRARIES
#
+# DEAL_II_BUILD_TYPES
+#
# *) Values marked with *) can be overwritten by the command line via
# -D<...>
#
SET(DEAL_II_PROJECT_CONFIG_NAME "${DEAL_II_PACKAGE_NAME}")
SET_IF_EMPTY(DEAL_II_BASE_NAME "deal_II")
-
SET_IF_EMPTY(DEAL_II_DEBUG_SUFFIX ".g")
+SET_IF_EMPTY(DEAL_II_RELEASE_SUFFIX "")
SET(DEAL_II_PATH ${CMAKE_INSTALL_PREFIX})
DEBUG
"${CMAKE_INSTALL_PREFIX}/${DEAL_II_LIBRARY_RELDIR}/${DEAL_II_LIBRARY_NAME_DEBUG}"
)
+
+ LIST(APPEND DEAL_II_BUILD_TYPES "DEBUG")
ENDIF()
IF(CMAKE_BUILD_TYPE MATCHES "Release")
RELEASE
"${CMAKE_INSTALL_PREFIX}/${DEAL_II_LIBRARY_RELDIR}/${DEAL_II_LIBRARY_NAME_RELEASE}"
)
+
+ LIST(APPEND DEAL_II_BUILD_TYPES "RELEASE")
ENDIF()
${DEAL_II_INCLUDE_DIRS}
)
- IF(CMAKE_BUILD_TYPE MATCHES "Debug")
- LIST(APPEND MAKEFILE_BUILD_TYPES "DEBUG")
- ENDIF()
- IF(CMAKE_BUILD_TYPE MATCHES "Release")
- LIST(APPEND MAKEFILE_BUILD_TYPES "RELEASE")
- ENDIF()
-
- FOREACH(type ${MAKEFILE_BUILD_TYPES})
- TO_STRING_AND_ADD_PREFIX(MAKEFILE_DEFINITIONS_${type}
+ FOREACH(build ${DEAL_II_BUILD_TYPES})
+ TO_STRING_AND_ADD_PREFIX(MAKEFILE_DEFINITIONS_${build}
"-D"
${DEAL_II_USER_DEFINITIONS}
- ${DEAL_II_USER_DEFINITIONS_${type}}
+ ${DEAL_II_USER_DEFINITIONS_${build}}
)
#
#
FOREACH(lib
${DEAL_II_EXTERNAL_LIBRARIES}
- ${DEAL_II_EXTERNAL_LIBRARIES_${type}}
- ${DEAL_II_LIBRARIES_${type}})
+ ${DEAL_II_EXTERNAL_LIBRARIES_${build}}
+ ${DEAL_II_LIBRARIES_${build}})
GET_FILENAME_COMPONENT(path ${lib} PATH)
- LIST(APPEND MAKEFILE_LIBS_${type} "-Wl,-rpath -Wl,${path}")
- LIST(APPEND MAKEFILE_LIBS_${type} ${lib})
+ LIST(APPEND MAKEFILE_LIBS_${build} "-Wl,-rpath -Wl,${path}")
+ LIST(APPEND MAKEFILE_LIBS_${build} ${lib})
ENDFOREACH()
- TO_STRING(MAKEFILE_LIBS_${type} ${MAKEFILE_LIBS_${type}})
+ TO_STRING(MAKEFILE_LIBS_${build} ${MAKEFILE_LIBS_${build}})
#
# Put our linker flags directly in front of this string:
#
- SET(MAKEFILE_LIBS_${type}
- "${CMAKE_SHARED_LINKER_FLAGS} ${DEAL_II_SHARED_LINKER_FLAGS_${type}} ${MAKEFILE_LIBS_${type}}"
+ SET(MAKEFILE_LIBS_${build}
+ "${CMAKE_SHARED_LINKER_FLAGS} ${DEAL_II_SHARED_LINKER_FLAGS_${build}} ${MAKEFILE_LIBS_${build}}"
)
ENDFOREACH()
ADD_SUBDIRECTORY(multigrid)
ADD_SUBDIRECTORY(numerics)
-IF(CMAKE_BUILD_TYPE MATCHES "Debug")
- #
- # Combine all debug OBJECT targets to a debug library:
- #
- FILE(STRINGS
- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/deal_ii_objects_debug
- deal_ii_objects_debug
- )
- ADD_LIBRARY(${DEAL_II_BASE_NAME}${DEAL_II_DEBUG_SUFFIX}
- ${deal_ii_objects_debug}
- )
-
- SET_TARGET_PROPERTIES(${DEAL_II_BASE_NAME}${DEAL_II_DEBUG_SUFFIX}
- PROPERTIES
- VERSION ${VERSION}
- #
- # Sonaming: Well... we just use the version number.
- # No point to wrack one's brain over the question whether a new version of
- # a C++ library is still ABI backwards compatible :-]
- #
- SOVERSION ${VERSION}
- LINK_FLAGS "${DEAL_II_SHARED_LINKER_FLAGS_DEBUG}"
- COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_DEBUG}"
- COMPILE_FLAGS "${DEAL_II_CXX_FLAGS_DEBUG}"
- )
-
- TARGET_LINK_LIBRARIES(${DEAL_II_BASE_NAME}${DEAL_II_DEBUG_SUFFIX}
- ${DEAL_II_EXTERNAL_LIBRARIES}
- ${DEAL_II_EXTERNAL_LIBRARIES_DEBUG}
- )
-
- INSTALL(TARGETS ${DEAL_II_BASE_NAME}${DEAL_II_DEBUG_SUFFIX}
- LIBRARY
- DESTINATION ${DEAL_II_LIBRARY_RELDIR}
- COMPONENT library
- )
-
-ENDIF()
-
-
-IF(CMAKE_BUILD_TYPE MATCHES "Release")
+FOREACH(build ${DEAL_II_BUILD_TYPES})
+ STRING(TOLOWER ${build} build_lowercase)
#
- # Combine all release OBJECT targets to a release library:
+ # Combine all ${build} OBJECT targets to a ${build} library:
#
FILE(STRINGS
- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/deal_ii_objects
- deal_ii_objects
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/deal_ii_objects_${build_lowercase}
+ deal_ii_objects_${build_lowercase}
)
- ADD_LIBRARY(${DEAL_II_BASE_NAME}
- ${deal_ii_objects}
+ ADD_LIBRARY(${DEAL_II_BASE_NAME}${DEAL_II_${build}_SUFFIX}
+ ${deal_ii_objects_${build_lowercase}}
)
- SET_TARGET_PROPERTIES(${DEAL_II_BASE_NAME}
+ SET_TARGET_PROPERTIES(${DEAL_II_BASE_NAME}${DEAL_II_${build}_SUFFIX}
PROPERTIES
VERSION ${VERSION}
#
# a C++ library is still ABI backwards compatible :-]
#
SOVERSION ${VERSION}
- LINK_FLAGS "${DEAL_II_SHARED_LINKER_FLAGS_RELEASE}"
- COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_RELEASE}"
- COMPILE_FLAGS "${DEAL_II_CXX_FLAGS_RELEASE}"
+ LINK_FLAGS "${DEAL_II_SHARED_LINKER_FLAGS_${build}}"
+ COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_${build}}"
+ COMPILE_FLAGS "${DEAL_II_CXX_FLAGS_${build}}"
)
- TARGET_LINK_LIBRARIES(${DEAL_II_BASE_NAME}
+ TARGET_LINK_LIBRARIES(${DEAL_II_BASE_NAME}${DEAL_II_${build}_SUFFIX}
${DEAL_II_EXTERNAL_LIBRARIES}
- ${DEAL_II_EXTERNAL_LIBRARIES_RELEASE}
+ ${DEAL_II_EXTERNAL_LIBRARIES_${build}}
)
- INSTALL(TARGETS ${DEAL_II_BASE_NAME}
+ INSTALL(TARGETS ${DEAL_II_BASE_NAME}${DEAL_II_${build}_SUFFIX}
LIBRARY
DESTINATION ${DEAL_II_LIBRARY_RELDIR}
COMPONENT library
)
-ENDIF()
+ENDFOREACH()
+