diff --git a/bin/duneproject b/bin/duneproject index ba4b7b89a940a450da619a7a7cc1ff1edab8d113..bc2224024b45e45bdabbbb39b73f30ed1c195951 100755 --- a/bin/duneproject +++ b/bin/duneproject @@ -225,6 +225,9 @@ while [ "$DATACORRECT" != "y" -a "$DATACORRECT" != "Y" ]; do while [ -z "$MAINTAINER" ]; do read -p "4) Maintainer's email address? " MAINTAINER done + while [ "$ENABLE_ALL" != "y" -a "$ENABLE_ALL" != "Y" ]; do + read -p "5) Enable all found packages? (WE strongly recommend yes, unless you know exactly what you are doing) [y/N]" ENABLE_ALL + done echo echo "creating Project \"$PROJECT\", version $VERSION " @@ -238,6 +241,7 @@ while [ "$DATACORRECT" != "y" -a "$DATACORRECT" != "Y" ]; do DEPENDENCIES="" VERSION="" MAINTAINER="" + ENABLE_ALL="" fi done @@ -501,7 +505,13 @@ include(DuneMacros) # start a dune project with information from dune.module dune_project() - +M_DELIM +if test ! -z "$ENABLE_ALL"; then +cat>> "$PROJECT/CMakeLists.txt" << M_DELIM +dune_enable_all_packages() +M_DELIM +fi +cat>> "$PROJECT/CMakeLists.txt" << M_DELIM add_subdirectory("src") add_subdirectory("m4") add_subdirectory("dune") diff --git a/cmake/modules/DuneBoost.cmake b/cmake/modules/DuneBoost.cmake index 89412661ed0f63fb6ba19c67cb93d0c93dbfbf8b..02caa70d1bea651535a06ec9dcc4251fc3547a28 100644 --- a/cmake/modules/DuneBoost.cmake +++ b/cmake/modules/DuneBoost.cmake @@ -12,12 +12,11 @@ find_package(Boost) set(HAVE_DUNE_BOOST ${Boost_FOUND}) -#add all boost realted flags to ALL_PKG_FLAGS, this must happen regardless of a target using add_dune_boost_flags +# register all boost related flags +# TODO What about boost libraries? Do we even rely on such? if(HAVE_DUNE_BOOST) - set_property(GLOBAL APPEND PROPERTY ALL_PKG_FLAGS "-DENABLE_BOOST=1") - foreach(dir ${Boost_INCLUDE_DIRS}) - set_property(GLOBAL APPEND PROPERTY ALL_PKG_FLAGS "-I${dir}") - endforeach() + dune_register_package_flags(COMPILE_DEFINITIONS "ENABLE_BOOST=1" + INCLUDE_DIRS "${Boost_INCLUDE_DIRS}") endif() function(add_dune_boost_flags _targets) @@ -38,4 +37,4 @@ function(add_dune_boost_flags _targets) "${_props} -DENABLE_BOOST=1") endforeach(_target) endif(Boost_FOUND) -endfunction(add_dune_boost_flags) \ No newline at end of file +endfunction(add_dune_boost_flags) diff --git a/cmake/modules/DuneCommonMacros.cmake b/cmake/modules/DuneCommonMacros.cmake index 6ba0cad3ce2dfaecf1ce3a1f0dc327c5f0ed5943..84b69d45ab8e20e6c1cd84f8611cd6065867bb8a 100644 --- a/cmake/modules/DuneCommonMacros.cmake +++ b/cmake/modules/DuneCommonMacros.cmake @@ -13,7 +13,7 @@ if(Fortran_Works) find_package(LAPACK) set(HAVE_LAPACK ${LAPACK_FOUND}) if(${HAVE_LAPACK}) - set_property(GLOBAL APPEND PROPERTY ALL_PKG_LIBS "${LAPACK_LIBRARIES}") + dune_register_package_flags(LIBRARIES "${LAPACK_LIBRARIES}") endif(${HAVE_LAPACK}) set(HAVE_BLAS ${BLAS_FOUND}) else(Fortran_Works) diff --git a/cmake/modules/DuneEnableAllPackages.cmake b/cmake/modules/DuneEnableAllPackages.cmake new file mode 100644 index 0000000000000000000000000000000000000000..5b244bf67a3b7f82c63ab52f27dfa96f7b6761d2 --- /dev/null +++ b/cmake/modules/DuneEnableAllPackages.cmake @@ -0,0 +1,222 @@ +# This module provides the macros necessary for a simplified CMake build system +# +# The dune build system relies on the user to choose and add the compile and link flags +# necessary to build an executable. While this offers full control to the user, it +# is an error-prone procedure. +# +# Alternatively, users may use this modules macros to simply add the compile flags for all +# found external modules to all executables in a module. Likewise, all found libraries are +# linked to all targets. +# +# This module provides the following macros: +# +# dune_enable_all_packages(INCLUDE_DIRS [include_dirs] +# COMPILE_DEFINITIONS [compile_definitions] +# MODULE_LIBRARIES [libraries] +# [VERBOSE] [APPEND] +# ) +# +# Adds all flags and all libraries to all executables that are subsequently added in the directory +# from where this macro is called and from all its subdirectories (recursively). +# If used, this macro MUST be called in the top level CMakeLists.txt BEFORE adding any subdirectories! +# You can optionally add additional include dirs and compile definitions that will also be applied to +# all targets in the module. +# Finally, if your module contains libraries as well as programs and if the programs should automatically +# link to those libraries, you MUST list these libraries in MODULE_LIBRARIES. Those libraries will be +# automatically created by dune_enable_all_packages (which internally calls dune_add_library()) and placed +# in the lib/ directory. The order of the libraries matters: if one library depends on another one, it must +# be listed after its dependency. This special handling of the libraries is due to the way newer CMake +# versions handle linking (in particular CMP022 and CMP038). You can later add source files to the library +# anywhere in the source tree by calling dune_library_add_sources(). +# +# Warning: The library feature requires CMake 3.1+. If you use the feature with older versions, CMake +# will emit a fatal error. Moreover, it will issue a warning if the cmake_minimum_required() +# version is older than 3.1. +# +# For a description of the APPEND option, see the documentation of dune_register_package_flags(). +# With the VERBOSE option being set, the list of flags is printed during configure. +# +# dune_register_package_flags(COMPILE_DEFINITIONS flags +# INCLUDE_DIRS includes +# LIBRARIES libs +# [APPEND] +# ) +# +# To implement above feature, the compile flags, include paths and link flags of all +# found packages must be registered with this macro. This macro is only necessary for people +# that do link against additional libraries which are not supported by the dune core modules. +# Call this at the end of every find module. If you are using an external find module which +# you cannot alter, call it after the call find_package(). +# The APPEND parameter appends the given flags to the global list instead of prepending. +# Only use it, if you know what you are doing. +# +# dune_library_add_sources(module_library +# SOURCES [sources] +# ) +# +# Adds the source files listed in [sources] to the module library module_library created by an earlier +# call to dune_enable_all_packages. +# + +function(dune_register_package_flags) + include(CMakeParseArguments) + set(OPTIONS APPEND) + set(SINGLEARGS) + set(MULTIARGS COMPILE_DEFINITIONS INCLUDE_DIRS LIBRARIES) + cmake_parse_arguments(REGISTRY "${OPTIONS}" "${SINGLEARGS}" "${MULTIARGS}" ${ARGN}) + + if(REGISTRY_UNPARSED_ARGUMENTS) + message(WARNING "Unrecognized arguments for dune_register_package_flags!") + endif() + + if(REGISTRY_APPEND) + set_property(GLOBAL APPEND PROPERTY ALL_PKG_INCS "${REGISTRY_INCLUDE_DIRS}") + set_property(GLOBAL APPEND PROPERTY ALL_PKG_LIBS "${REGISTRY_LIBRARIES}") + set_property(GLOBAL APPEND PROPERTY ALL_PKG_DEFS "${REGISTRY_COMPILE_DEFINITIONS}") + else(REGISTRY_APPEND) + get_property(all_incs GLOBAL PROPERTY ALL_PKG_INCS) + get_property(all_libs GLOBAL PROPERTY ALL_PKG_LIBS) + get_property(all_defs GLOBAL PROPERTY ALL_PKG_DEFS) + set_property(GLOBAL PROPERTY ALL_PKG_INCS "${REGISTRY_INCLUDE_DIRS}" "${all_incs}") + set_property(GLOBAL PROPERTY ALL_PKG_LIBS "${REGISTRY_LIBRARIES}" "${all_libs}") + set_property(GLOBAL PROPERTY ALL_PKG_DEFS "${REGISTRY_COMPILE_DEFINITIONS}" "${all_defs}") + endif(REGISTRY_APPEND) +endfunction(dune_register_package_flags) + + +macro(dune_enable_all_packages) + include(CMakeParseArguments) + set(OPTIONS APPEND VERBOSE) + set(SINGLEARGS) + set(MULTIARGS COMPILE_DEFINITIONS INCLUDE_DIRS MODULE_LIBRARIES) + cmake_parse_arguments(DUNE_ENABLE_ALL_PACKAGES "${OPTIONS}" "${SINGLEARGS}" "${MULTIARGS}" ${ARGN}) + + if(DUNE_ENABLE_ALL_PACKAGES_UNPARSED_ARGUMENTS) + message(WARNING "Unrecognized arguments for dune_enable_all_packages!") + endif() + + # handle additional include dirs specified in dune_enable_all_packages + if(DUNE_ENABLE_ALL_PACKAGES_INCLUDE_DIRS) + if(DUNE_ENABLE_ALL_PACKAGES_APPEND) + set_property(GLOBAL APPEND PROPERTY ALL_PKG_INCS "${DUNE_ENABLE_ALL_PACKAGES_INCLUDE_DIRS}") + else(DUNE_ENABLE_ALL_PACKAGES_APPEND) + get_property(all_incs GLOBAL PROPERTY ALL_PKG_INCS) + set_property(GLOBAL PROPERTY ALL_PKG_INCS "${DUNE_ENABLE_ALL_PACKAGES_INCLUDE_DIRS}" "${all_incs}") + endif(DUNE_ENABLE_ALL_PACKAGES_APPEND) + endif(DUNE_ENABLE_ALL_PACKAGES_INCLUDE_DIRS) + + # add include dirs to all targets in module + get_property(all_incs GLOBAL PROPERTY ALL_PKG_INCS) + include_directories(${all_incs}) + # verbose output of include dirs + if(DUNE_ENABLE_ALL_PACKAGES_VERBOSE) + message("Include directories for this project: ${all_incs}") + endif(DUNE_ENABLE_ALL_PACKAGES_VERBOSE) + + # handle additional compile definitions specified in dune_enable_all_packages + if(DUNE_ENABLE_ALL_PACKAGES_COMPILE_DEFINITIONS) + if(DUNE_ENABLE_ALL_PACKAGES_COMPILE_DEFINITIONS) + set_property(GLOBAL APPEND PROPERTY ALL_PKG_DEFS "${DUNE_ENABLE_ALL_PACKAGES_COMPILE_DEFINITIONS}") + else(DUNE_ENABLE_ALL_PACKAGES_APPEND) + get_property(all_defs GLOBAL PROPERTY ALL_PKG_DEFS) + set_property(GLOBAL PROPERTY ALL_PKG_DEFS "${DUNE_ENABLE_ALL_PACKAGES_COMPILE_DEFINITIONS}" "${all_defs}") + endif(DUNE_ENABLE_ALL_PACKAGES_APPEND) + endif(DUNE_ENABLE_ALL_PACKAGES_COMPILE_DEFINITIONS) + + # add compile definitions to all targets in module + get_property(all_defs GLOBAL PROPERTY ALL_PKG_DEFS) + foreach(def ${all_defs}) + add_definitions("-D${def}") + endforeach(def in ${all_defs}) + # verbose output of compile definitions + if(DUNE_ENABLE_ALL_PACKAGES_VERBOSE) + message("Compile definitions for this project: ${all_defs}") + endif(DUNE_ENABLE_ALL_PACKAGES_VERBOSE) + + # handle libraries + # this is a little tricky because the libraries defined within the current module require special + # handling to avoid tripping over CMake policies CMP022 and CMP038 + + # first add all libraries of upstream Dune modules and of external dependencies + get_property(all_libs GLOBAL PROPERTY ALL_PKG_LIBS) + link_libraries(${DUNE_LIBS} ${all_libs}) + + # now we have to do a little dance: Newer versions of CMake complain if a target links to itself, + # so we have to create all targets for libraries inside the module before adding them to the set + # of default libraries to link to. That works because calling link_libraries does not affect targets + # which already exist. + # Moroever, CMake generates a warning when creating a library without any source files, and the linker + # does the same if we add an empty dummy file. We work around that problem by autogenerating a library-specific + # stub source file with two functions ${lib_name}_version() and ${lib_name}_version_string() and add that + # as an initial source file. + # After creating the library with dune_add_library(), we add it to all future targets with a call to + # link_libraries(). The user can then add the real source files by calling dune_library_add_sources() + # throughout the module. + + if(DUNE_ENABLE_ALL_PACKAGES_MODULE_LIBRARIES) + + # This only works for CMAKE 3.1+ because target_sources() - which we use to add sources to the + # libraries after creating them - was added in that version + if (CMAKE_VERSION VERSION_LESS 3.1.0) + message(FATAL_ERROR "dune_enable_all_packages() only supports MODULE_LIBRARIES for CMake 3.1+") + elseif(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 3.1.0) + message(WARNING +"You are using dune_enable_all_packages() with the MODULE_LIBRARIES feature. +This requires at least CMake 3.1, but your Dune module only requires ${CMAKE_MINIMUM_REQUIRED_VERSION}. +Update the cmake_minimum_required() call in your main CMakeLists.txt file to get rid of this warning.") + endif() + + # make sure the /lib directory exists - we need it to create the stub source file in there + file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/lib") + # figure out the location of the stub source template + dune_common_script_dir(script_dir) + foreach(module_lib ${DUNE_ENABLE_ALL_PACKAGES_MODULE_LIBRARIES}) + # create the stub source file in the output directory... + configure_file("${script_dir}/module_library.cc.in" "${PROJECT_BINARY_DIR}/lib/lib${module_lib}_stub.cc") + # ...and create the library... + dune_add_library(${module_lib} SOURCES "${PROJECT_BINARY_DIR}/lib/lib${module_lib}_stub.cc") + # ...and add it to all future targets in the module + link_libraries(${module_lib}) + endforeach(module_lib ${DUNE_ENABLE_ALL_PACKAGES_MODULE_LIBRARIES}) + endif(DUNE_ENABLE_ALL_PACKAGES_MODULE_LIBRARIES) + + if(DUNE_ENABLE_ALL_PACKAGES_VERBOSE) + get_property(all_libs GLOBAL PROPERTY ALL_PKG_LIBS) + message("Libraries for this project: ${all_libs}") + endif(DUNE_ENABLE_ALL_PACKAGES_VERBOSE) + +endmacro(dune_enable_all_packages) + + +macro(dune_library_add_sources lib) + + # This only works for CMAKE 3.1+ because target_sources() - which we use to add sources to the + # libraries after creating them - was added in that version + if (CMAKE_VERSION VERSION_LESS 3.1.0) + message(FATAL_ERROR "dune_library_add_sources() requires CMake 3.1+") + endif() + + if (NOT (DEFINED DUNE_ENABLE_ALL_PACKAGES_MODULE_LIBRARIES)) + message(FATAL_ERROR "You must call dune_enable_all_packages with the MODULE_LIBRARIES option before calling dune_library_add_sources") + endif() + + # This looks weird, but seems to be the most practical way to check for list membership, + # as list(FIND ...) does not work reliably in a macro... + if (NOT (";${DUNE_ENABLE_ALL_PACKAGES_MODULE_LIBRARIES};" MATCHES ";${lib};")) + message(FATAL_ERROR +"Attempt to add sources to library ${lib}, which has not been defined in dune_enable_all_packages. +List of libraries defined in dune_enable_all_packages: ${DUNE_ENABLE_ALL_PACKAGES_MODULE_LIBRARIES}") + endif() + unset(lib_defined) + + include(CMakeParseArguments) + cmake_parse_arguments(DUNE_LIBRARY_ADD_SOURCES "" "" "SOURCES" ${ARGN}) + + if(DUNE_LIBRARY_ADD_SOURCES_UNPARSED_ARGUMENTS) + message(WARNING "Unrecognized arguments for dune_library_add_sources!") + endif() + + foreach(source ${DUNE_LIBRARY_ADD_SOURCES_SOURCES}) + target_sources(${lib} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/${source}) + endforeach() +endmacro() diff --git a/cmake/modules/DuneMPI.cmake b/cmake/modules/DuneMPI.cmake index c29d356aac89a2fb1deb144973569bc0d13be811..4ea6d69331da7eabf6a9b8e3e660aadd9eb8cd9f 100644 --- a/cmake/modules/DuneMPI.cmake +++ b/cmake/modules/DuneMPI.cmake @@ -34,10 +34,10 @@ if(MPI_C_FOUND) set(MPI_DUNE_LIBRARIES ${CMAKE_THREAD_LIBS_INIT} ${MPI_C_LIBRARIES} CACHE STRING "Libraries used by DUNE when linking MPI programs") - set_property(GLOBAL APPEND PROPERTY ALL_PKG_FLAGS "-DENABLE_MPI=1 -DMPICH_SKIP_MPICXX -DMPIPP_H") - foreach(dir ${MPI_DUNE_INCLUDE_PATH}) - set_property(GLOBAL APPEND PROPERTY ALL_PKG_FLAGS "-I${dir}") - endforeach() + # TODO check on where to position this exactly, doesnt look completely thought through + dune_register_package_flags(COMPILE_DEFINITIONS "ENABLE_MPI=1;MPICH_SKIP_MPICXX;MPIPP_H" + INCLUDE_DIRS "${MPI_DUNE_INCLUDE_PATH}" + LIBRARIES "${MPI_DUNE_LIBRARIES}") # Check whether the MPI-2 standard is supported include(CMakePushCheckState) diff --git a/cmake/modules/DuneMacros.cmake b/cmake/modules/DuneMacros.cmake index 876c4b063ed93d47e9888a54db5b4fa40cf2d0cf..fac005ad643157b16420d3fd7b614852c39466ba 100644 --- a/cmake/modules/DuneMacros.cmake +++ b/cmake/modules/DuneMacros.cmake @@ -79,6 +79,7 @@ enable_language(C) # Enable C to skip CXX bindings for some tests. include(FeatureSummary) +include(DuneEnableAllPackages) include(DuneSymlinkOrCopy) @@ -525,10 +526,8 @@ macro(dune_process_dependency_macros) endforeach(_lib ${${_mod}_LIBRARIES}) endif(${_mod}_LIBRARIES) - #update ALL_PKG_FLAGS - foreach(dir ${${_mod}_INCLUDE_DIRS}) - set_property(GLOBAL APPEND PROPERTY ALL_PKG_FLAGS "-I${dir}") - endforeach() + # register dune module + dune_register_package_flags(INCLUDE_DIRS "${${_mod}_INCLUDE_DIRS}") endif(NOT ${_mod}_PROCESSED) endforeach(_mod DEPENDENCIES) endmacro(dune_process_dependency_macros) @@ -1163,16 +1162,12 @@ and a replacement string. ${REPLACE_UNPARSED_ARGUMENTS}") endfunction(replace_properties) macro(add_dune_all_flags targets) - get_property(flags GLOBAL PROPERTY ALL_PKG_FLAGS) - set(FLAGSTR "") - foreach(flag ${flags}) - set(FLAGSTR "${FLAGSTR}\ ${flag}") - endforeach() + get_property(incs GLOBAL PROPERTY ALL_PKG_INCS) + get_property(defs GLOBAL PROPERTY ALL_PKG_DEFS) + get_property(libs GLOBAL PROPERTY ALL_PKG_LIBS) foreach(target ${targets}) - set_property(TARGET ${target} - APPEND_STRING - PROPERTY COMPILE_FLAGS ${FLAGSTR}) - get_property(libs GLOBAL PROPERTY ALL_PKG_LIBS) + set_property(TARGET ${target} APPEND PROPERTY INCLUDE_DIRECTORIES ${incs}) + set_property(TARGET ${target} APPEND PROPERTY COMPILE_DEFINITIONS ${defs}) target_link_libraries(${target} ${DUNE_LIBS} ${libs}) endforeach() endmacro(add_dune_all_flags targets) diff --git a/cmake/modules/FindGMP.cmake b/cmake/modules/FindGMP.cmake index 0b416dae7e7b1f0373adfd77ed876837e3950afd..8559f8ae26344de17c404257189b8391f3d454ed 100644 --- a/cmake/modules/FindGMP.cmake +++ b/cmake/modules/FindGMP.cmake @@ -82,11 +82,9 @@ endif(GMP_FOUND) # set HAVE_GMP for config.h set(HAVE_GMP ${GMP_FOUND}) -#add all GMP related flags to ALL_PKG_FLAGS, this must happen regardless of a target using add_dune_gmp_flags +# register all GMP related flags if(HAVE_GMP) - set_property(GLOBAL APPEND PROPERTY ALL_PKG_FLAGS "-DENABLE_GMP=1") - foreach(dir ${GMP_INCLUDE_DIR}) - set_property(GLOBAL APPEND PROPERTY ALL_PKG_FLAGS "-I${dir}") - endforeach() - set_property(GLOBAL APPEND PROPERTY ALL_PKG_LIBS "${GMP_LIB}" "${GMPXX_LIB}") + dune_register_package_flags(COMPILE_DEFINITIONS "ENABLE_GMP=1" + LIBRARIES "${GMP_LIB};${GMPXX_LIB}" + INCLUDE_DIRS "${GMP_INCLUDE_DIR}") endif() diff --git a/cmake/modules/FindMETIS.cmake b/cmake/modules/FindMETIS.cmake index fbbe35cb518fc6ab645648502a389e6d454e783e..c6b6626566764d0bde873ce49c4952331a0f9182 100644 --- a/cmake/modules/FindMETIS.cmake +++ b/cmake/modules/FindMETIS.cmake @@ -91,10 +91,8 @@ else(METIS_FOUND) "Library directory: ${METIS_LIBRARIES}\n\n") endif(METIS_FOUND) -#add all metis related flags to ALL_PKG_FLAGS, this must happen regardless of a target using add_dune_metis_flags +# register all METIS related flags if(METIS_FOUND) - foreach(dir ${METIS_INCLUDE_DIRS}) - set_property(GLOBAL APPEND PROPERTY ALL_PKG_FLAGS "-I${dir}") - endforeach() - set_property(GLOBAL APPEND PROPERTY ALL_PKG_LIBS "${METIS_LIBRARIES}") + dune_register_package_flags(LIBRARIES "${METIS_LIBRARIES}" + INCLUDE_DIRECTORIES "${METIS_INCLUDE_DIRS}") endif() diff --git a/cmake/modules/FindParMETIS.cmake b/cmake/modules/FindParMETIS.cmake index ec5bb6b88ce3636988ecae3ea4db68e9d4a5f29c..010d9c7f36368364bd303ede9191902e242d07ef 100644 --- a/cmake/modules/FindParMETIS.cmake +++ b/cmake/modules/FindParMETIS.cmake @@ -98,10 +98,9 @@ if(PARMETIS_FOUND) "Library directory: ${PARMETIS_LIBRARIES}\n\n") endif(PARMETIS_FOUND) -#add all parmetis related flags to ALL_PKG_FLAGS, this must happen regardless of a target using add_dune_parmetis_flags +# register all ParMETIS related flags if(PARMETIS_FOUND) - foreach(dir ${PARMETIS_INCLUDE_DIRS}) - set_property(GLOBAL APPEND PROPERTY ALL_PKG_FLAGS "-I${dir}") - endforeach() - set_property(GLOBAL APPEND PROPERTY ALL_PKG_LIBS "${PARMETIS_LIBRARIES}") + dune_register_package_flags(COMPILE_DEFINITIONS "ENABLE_PARMETIS=1" + LIBRARIES "${PARMETIS_LIBRARIES}" + INCLUDE_DIRS "${PARMETIS_INCLUDE_DIRS}") endif() diff --git a/cmake/modules/FindUMFPack.cmake b/cmake/modules/FindUMFPack.cmake index 2fef792362c31290a7b3cdf7f4c2056f7215288b..c25ba6a37c4f668a1d005c5833c3bb5fe10b3c4a 100644 --- a/cmake/modules/FindUMFPack.cmake +++ b/cmake/modules/FindUMFPack.cmake @@ -94,11 +94,9 @@ endif(UMFPACK_FOUND) #set HAVE_UMFPACK for config.h set(HAVE_UMFPACK ${UMFPACK_FOUND}) -#add all umfpack related flags to ALL_PKG_FLAGS, this must happen regardless of a target using add_dune_umfpack_flags +# register all umfpack related flags if(UMFPACK_FOUND) - set_property(GLOBAL APPEND PROPERTY ALL_PKG_FLAGS "${UMFPACK_DUNE_COMPILE_FLAGS}") - foreach(dir "${UMFPACK_INCLUDE_DIRS}") - set_property(GLOBAL APPEND PROPERTY ALL_PKG_FLAGS "-I${dir}") - endforeach() - set_property(GLOBAL APPEND PROPERTY ALL_PKG_LIBS "${UMFPACK_LIBRARIES}") + dune_register_package_flags(COMPILE_DEFINITIONS "ENABLE_UMFPACK=1" + LIBRARIES "${UMFPACK_LIBRARIES}" + INCLUDE_DIRS "${UMFPACK_INCLUDE_DIRS}") endif() diff --git a/cmake/scripts/module_library.cc.in b/cmake/scripts/module_library.cc.in new file mode 100644 index 0000000000000000000000000000000000000000..97189eb7dbed3a19126f386eaaace3cab78e13cd --- /dev/null +++ b/cmake/scripts/module_library.cc.in @@ -0,0 +1,11 @@ +#include <string> + +std::size_t ${module_lib}_version() +{ + return ${ProjectVersionMajor} * 10000 + ${ProjectVersionMinor} * 100 + ${ProjectVersionRevision}; +} + +std::string ${module_lib}_version_string() +{ + return "${ProjectVersion}"; +}