# ADD_FLAGS(variable flags)
#
-MACRO(ADD_FLAGS variable flags)
- SET(${variable} "${${variable}} ${flags}")
+MACRO(ADD_FLAGS _variable _flags)
+ SET(${_variable} "${${_variable}} ${_flags}")
ENDMACRO()
# (This just inverts the logic of CHECK_CXX_SOURCE_COMPILES.)
#
-MACRO(CHECK_CXX_COMPILER_BUG source var)
+MACRO(CHECK_CXX_COMPILER_BUG _source _var)
CHECK_CXX_SOURCE_COMPILES(
- "${source}"
- ${var}_OK)
+ "${_source}"
+ ${_var}_OK)
- IF(${var}_OK)
- MESSAGE(STATUS "Test successful, do not define ${var}")
+ IF(${_var}_OK)
+ MESSAGE(STATUS "Test successful, do not define ${_var}")
ELSE()
- MESSAGE(STATUS "Test unsuccessful, define ${var}")
- SET(${var} 1)
+ MESSAGE(STATUS "Test unsuccessful, define ${_var}")
+ SET(${_var} TRUE)
ENDIF()
ENDMACRO()
# COND_SET_TO_YES(bool variable)
#
-MACRO(COND_SET_TO_YES bool variable)
- IF(${bool})
- SET(${variable} "yes")
+MACRO(COND_SET_TO_YES _bool _variable)
+ IF(${_bool})
+ SET(${_variable} "yes")
ELSE()
- SET(${variable} "no")
+ SET(${_variable} "no")
ENDIF()
ENDMACRO()
# See macro_deal_ii_add_library.cmake for an explanation of this macro
#
-MACRO(DEAL_II_ADD_C_LIBRARY library)
+MACRO(DEAL_II_ADD_C_LIBRARY _library)
- FOREACH(build ${DEAL_II_BUILD_TYPES})
- STRING(TOLOWER ${build} build_lowercase)
+ FOREACH(_build ${DEAL_II_BUILD_TYPES})
+ STRING(TOLOWER ${_build} _build_lowercase)
- ADD_LIBRARY(${library}.${build_lowercase}
+ ADD_LIBRARY(${_library}.${_build_lowercase}
${ARGN}
)
- 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}}"
+ 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}/deal_ii_objects_${build_lowercase}
- "$<TARGET_OBJECTS:${library}.${build_lowercase}>\n"
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/deal_ii_objects_${_build_lowercase}
+ "$<TARGET_OBJECTS:${_library}.${_build_lowercase}>\n"
)
ENDFOREACH()
# to _add_ compile definitions to every target we have specified.
#
-MACRO(DEAL_II_ADD_DEFINITIONS name)
+MACRO(DEAL_II_ADD_DEFINITIONS _name)
- FOREACH(build ${DEAL_II_BUILD_TYPES})
- STRING(TOLOWER ${build} build_lowercase)
+ FOREACH(_build ${DEAL_II_BUILD_TYPES})
+ STRING(TOLOWER ${_build} _build_lowercase)
- GET_TARGET_PROPERTY(macro_definitions ${name}.${build_lowercase} COMPILE_DEFINITIONS)
- SET_TARGET_PROPERTIES(${name}.${build_lowercase} PROPERTIES
- COMPILE_DEFINITIONS "${ARGN};${macro_definitions}"
+ GET_TARGET_PROPERTY(_definitions ${_name}.${_build_lowercase} COMPILE_DEFINITIONS)
+ SET_TARGET_PROPERTIES(${_name}.${_build_lowercase} PROPERTIES
+ COMPILE_DEFINITIONS "${ARGN};${_macro_definitions}"
)
ENDFOREACH()
# types specified in DEAL_II_BUILD_TYPES
#
-MACRO(DEAL_II_ADD_DEPENDENCIES name target)
+MACRO(DEAL_II_ADD_DEPENDENCIES _name _target)
- FOREACH(build ${DEAL_II_BUILD_TYPES})
- STRING(TOLOWER ${build} build_lowercase)
- ADD_DEPENDENCIES(${name}.${build_lowercase}
- ${target}.${build_lowercase}
+ FOREACH(_build ${DEAL_II_BUILD_TYPES})
+ STRING(TOLOWER ${_build} _build_lowercase)
+ ADD_DEPENDENCIES(${_name}.${_build_lowercase}
+ ${_target}.${_build_lowercase}
)
ENDFOREACH()
# DEAL_II_DEFINITIONS
#
-MACRO(DEAL_II_ADD_LIBRARY library)
+MACRO(DEAL_II_ADD_LIBRARY _library)
- FOREACH(build ${DEAL_II_BUILD_TYPES})
- STRING(TOLOWER ${build} build_lowercase)
+ FOREACH(_build ${DEAL_II_BUILD_TYPES})
+ STRING(TOLOWER ${_build} _build_lowercase)
- ADD_LIBRARY(${library}.${build_lowercase}
+ ADD_LIBRARY(${_library}.${_build_lowercase}
${ARGN}
)
- 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}}"
+ 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}/deal_ii_objects_${build_lowercase}
- "$<TARGET_OBJECTS:${library}.${build_lowercase}>\n"
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/deal_ii_objects_${_build_lowercase}
+ "$<TARGET_OBJECTS:${_library}.${_build_lowercase}>\n"
)
ENDFOREACH()
#
#
-MACRO(DEAL_II_SETUP_TARGET target)
+MACRO(DEAL_II_SETUP_TARGET _target)
IF(NOT DEAL_II_PROJECT_CONFIG_INCLUDED)
MESSAGE(FATAL_ERROR
# Necessary for setting INCLUDE_DIRECTORIES via SET_TARGET_PROPERTIES
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)
- GET_DIRECTORY_PROPERTY(inc_dirs_so_far INCLUDE_DIRECTORIES)
- SET_TARGET_PROPERTIES(${target} PROPERTIES
+ GET_DIRECTORY_PROPERTY(_inc_dirs_so_far INCLUDE_DIRECTORIES)
+ SET_TARGET_PROPERTIES(${_target} PROPERTIES
INCLUDE_DIRECTORIES
- "${inc_dirs_so_far};${DEAL_II_EXTERNAL_INCLUDE_DIRS};${DEAL_II_INCLUDE_DIRS}"
+ "${_inc_dirs_so_far};${DEAL_II_EXTERNAL_INCLUDE_DIRS};${DEAL_II_INCLUDE_DIRS}"
LINK_FLAGS
"${DEAL_II_LINKER_FLAGS}"
COMPILE_DEFINITIONS
#
# Set build type dependend flags and definitions:
#
- FOREACH(build ${DEAL_II_BUILD_TYPES})
- SET_TARGET_PROPERTIES(${target} PROPERTIES
- LINK_FLAGS_${build}
- "${DEAL_II_LINKER_FLAGS_${build}}"
- COMPILE_DEFINITIONS_${build}
- "${DEAL_II_USER_DEFINITIONS_${build}}"
+ FOREACH(_build ${DEAL_II_BUILD_TYPES})
+ 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}}
+ 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
# ENABLE_IF_LINKS(variable flag)
#
-MACRO(ENABLE_IF_LINKS variable flag)
- ADD_FLAGS(CMAKE_REQUIRED_FLAGS "${flag}")
+MACRO(ENABLE_IF_LINKS _variable _flag)
+ ADD_FLAGS(CMAKE_REQUIRED_FLAGS "${_flag}")
CHECK_CXX_SOURCE_COMPILES(
"
int main() { return 0; }
"
- DEAL_II_HAVE_FLAG_${flag}
+ DEAL_II_HAVE_FLAG_${_flag}
)
- STRIP_FLAG(CMAKE_REQUIRED_FLAGS "${flag}")
- IF(DEAL_II_HAVE_FLAG_${flag})
- SET(${variable} "${${variable}} ${flag}")
+ STRIP_FLAG(CMAKE_REQUIRED_FLAGS "${_flag}")
+ IF(DEAL_II_HAVE_FLAG_${_flag})
+ SET(${_variable} "${${_variable}} ${_flag}")
ENDIF()
ENDMACRO()
# ENABLE_IF_SUPPORTED(variable flag)
#
-MACRO(ENABLE_IF_SUPPORTED variable flag)
+MACRO(ENABLE_IF_SUPPORTED _variable _flag)
CHECK_CXX_COMPILER_FLAG(
- "${flag}"
- DEAL_II_HAVE_FLAG_${flag}
+ "${_flag}"
+ DEAL_II_HAVE_FLAG_${_flag}
)
- IF(DEAL_II_HAVE_FLAG_${flag})
- SET(${variable} "${${variable}} ${flag}")
+ IF(DEAL_II_HAVE_FLAG_${_flag})
+ SET(${_variable} "${${_variable}} ${_flag}")
ENDIF()
ENDMACRO()
# a list of inst.in files that will be expanded
#
-MACRO(EXPAND_INSTANTIATIONS target inst_in_files)
- FOREACH (inst_in_file ${inst_in_files})
- STRING(REGEX REPLACE "\\.in$" "" inst_file "${inst_in_file}" )
+MACRO(EXPAND_INSTANTIATIONS _target _inst_in_files)
+ FOREACH (_inst_in_file ${_inst_in_files})
+ STRING(REGEX REPLACE "\\.in$" "" _inst_file "${_inst_in_file}" )
ADD_CUSTOM_COMMAND(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${inst_file}
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_inst_file}
DEPENDS expand_instantiations
- ${CMAKE_CURRENT_SOURCE_DIR}/${inst_in_file}
+ ${CMAKE_CURRENT_SOURCE_DIR}/${_inst_in_file}
COMMAND expand_instantiations
ARGS ${CMAKE_BINARY_DIR}/config/template-arguments
- < ${CMAKE_CURRENT_SOURCE_DIR}/${inst_in_file}
- > ${CMAKE_CURRENT_BINARY_DIR}/${inst_file}
+ < ${CMAKE_CURRENT_SOURCE_DIR}/${_inst_in_file}
+ > ${CMAKE_CURRENT_BINARY_DIR}/${_inst_file}
)
- LIST(APPEND inst_targets ${CMAKE_CURRENT_BINARY_DIR}/${inst_file})
+ LIST(APPEND _inst_targets ${CMAKE_CURRENT_BINARY_DIR}/${_inst_file})
ENDFOREACH()
#
# Define a custom target that depends on the generation of all inst.in
# files.
#
- ADD_CUSTOM_TARGET(${target}.inst ALL DEPENDS ${inst_targets})
+ ADD_CUSTOM_TARGET(${_target}.inst ALL DEPENDS ${_inst_targets})
#
# Add a dependency to all target.${build_type} so that target.inst is
# fully generated before target will be processed.
#
- FOREACH(build ${DEAL_II_BUILD_TYPES})
- STRING(TOLOWER ${build} build_lowercase)
- ADD_DEPENDENCIES(${target}.${build_lowercase} ${target}.inst)
+ FOREACH(_build ${DEAL_II_BUILD_TYPES})
+ STRING(TOLOWER ${_build} _build_lowercase)
+ ADD_DEPENDENCIES(${_target}.${_build_lowercase} ${_target}.inst)
ENDFOREACH()
ENDMACRO()
#
# TODO: Description...
#
-MACRO(GET_CXX_SOURCE_RETURN_VALUE SOURCE VAR EXIT_CODE)
+MACRO(GET_CXX_SOURCE_RETURN_VALUE _source _var _exit_code)
#
# TODO: This file is still very basic :-]
#
- FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx"
- "${SOURCE}\n")
+ IF(NOT DEFINED ${_var})
+ FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx"
+ "${_source}\n")
- MESSAGE(STATUS "Performing Test ${VAR}")
+ MESSAGE(STATUS "Performing Test ${_var}")
- TRY_RUN(
- ${VAR}_EXIT_CODE
- ${VAR}_COMPILE_OK
- ${CMAKE_BINARY_DIR}
- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx)
+ TRY_RUN(
+ ${_var}_EXIT_CODE
+ ${_var}_COMPILE_OK
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx)
- IF(${VAR}_COMPILE_OK)
- SET(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
- SET(${EXIT_CODE} ${VAR_EXIT_CODE} CACHE INTERNAL "Test ${EXIT_CODE}")
- MESSAGE(STATUS "Performing Test ${VAR} - Success")
+ IF(${_var}_COMPILE_OK)
+ SET(${_var} 1 CACHE INTERNAL "Test ${_var}")
+ SET(${_exit_code} ${${_var}_EXIT_CODE} CACHE INTERNAL "Test ${_exit_code}")
+ MESSAGE(STATUS "Performing Test ${_var} - Success")
- FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
- "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n"
- "${OUTPUT}\n"
- "Return value: ${${VAR}}\n"
- "Source file was:\n${SOURCE}\n")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Performing C++ SOURCE FILE Test ${_var} succeded with the following output:\n"
+ "${OUTPUT}\n"
+ "Return value: ${${_var}}\n"
+ "Source file was:\n${_source}\n")
- ELSE()
+ ELSE()
- SET(${VAR} 0 CACHE INTERNAL "Test ${VAR}")
- MESSAGE(STATUS "Performing Test ${VAR} - Failed")
+ SET(${_var} 0 CACHE INTERNAL "Test ${_var}")
+ MESSAGE(STATUS "Performing Test ${_var} - Failed")
- FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
- "Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n"
- "${OUTPUT}\n"
- "Return value: ${${VAR}_EXITCODE}\n"
- "Source file was:\n${SOURCE}\n")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Performing C++ SOURCE FILE Test ${_var} failed with the following output:\n"
+ "${OUTPUT}\n"
+ "Return value: ${${_var}_EXITCODE}\n"
+ "Source file was:\n${_source}\n")
+ ENDIF()
ENDIF()
-
ENDMACRO()
# STREQUAL.
#
-MACRO(LIST_CONTAINS var value)
- SET(${var})
- FOREACH (value2 ${ARGN})
- IF (${value} STREQUAL ${value2})
- SET(${var} TRUE)
- ENDIF (${value} STREQUAL ${value2})
- ENDFOREACH (value2)
-ENDMACRO(LIST_CONTAINS)
+MACRO(LIST_CONTAINS _var _value)
+ SET(${_var})
+ FOREACH (_value2 ${ARGN})
+ IF("${_value}" STREQUAL "${_value2}")
+ SET(${_var} TRUE)
+ BREAK()
+ ENDIF()
+ ENDFOREACH()
+ENDMACRO()
MACRO(POP_TEST_FLAG)
SET(CMAKE_REQUIRED_FLAGS " ${CMAKE_REQUIRED_FLAGS}")
- STRING(REGEX REPLACE " -[^ ]+$" ""
+ STRING(REGEX REPLACE " [^ ]+$" ""
CMAKE_REQUIRED_FLAGS
"${CMAKE_REQUIRED_FLAGS}"
)
# PUSH_TEST_FLAG("flag")
#
-MACRO(PUSH_TEST_FLAG flag)
+MACRO(PUSH_TEST_FLAG _flag)
- SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}")
+ SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${_flag}")
STRING(STRIP "${CMAKE_REQUIRED_FLAGS}" CMAKE_REQUIRED_FLAGS)
ENDMACRO()
#
# If 'variable' is empty it will be set to 'value'
#
-MACRO(SET_IF_EMPTY variable value)
- IF("${${variable}}" STREQUAL "")
- SET(${variable} ${value})
+MACRO(SET_IF_EMPTY _variable _value)
+ IF("${${_variable}}" STREQUAL "")
+ SET(${_variable} ${_value})
ENDIF()
ENDMACRO()
# STRIP_FLAG(variable flag)
#
-MACRO(STRIP_FLAG variable flag)
- SET(${variable} " ${${variable}}")
- STRING(REPLACE " ${flag}" "" "${variable}" ${${variable}})
- STRING(STRIP "${${variable}}" ${variable})
+MACRO(STRIP_FLAG _variable _flag)
+ SET(${_variable} " ${${_variable}}")
+ STRING(REPLACE " ${_flag}" "" "${_variable}" ${${_variable}})
+ STRING(STRIP "${${_variable}}" ${_variable})
ENDMACRO()
# TO_STRING(string ${list1} ${list2} ...)
#
-MACRO(TO_STRING variable)
- SET(${variable} "")
- FOREACH(var ${ARGN})
- SET(${variable} "${${variable}} ${var}")
+MACRO(TO_STRING _variable)
+ SET(${_variable} "")
+ FOREACH(_var ${ARGN})
+ SET(${_variable} "${${_variable}} ${_var}")
ENDFOREACH()
- STRING(STRIP "${${variable}}" ${variable})
+ STRING(STRIP "${${_variable}}" ${_variable})
ENDMACRO()
# TO_STRING_AND_ADD_PREFIX(string "prefix" ${list1} ${list2} ...)
#
-MACRO(TO_STRING_AND_ADD_PREFIX variable prefix)
- SET(${variable} "")
- FOREACH(var ${ARGN})
- SET(${variable} "${${variable}} ${prefix}${var}")
+MACRO(TO_STRING_AND_ADD_PREFIX _variable _prefix)
+ SET(${_variable} "")
+ FOREACH(_var ${ARGN})
+ SET(${_variable} "${${_variable}} ${_prefix}${_var}")
ENDFOREACH()
- STRING(STRIP "${${variable}}" ${variable})
+ STRING(STRIP "${${_variable}}" ${_variable})
ENDMACRO()