From: maier Date: Wed, 21 Aug 2013 22:17:00 +0000 (+0000) Subject: CMake: Split library lists depending on optimized, debug or general keywords X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0795c4f1eca66da7002f007cddf565779d77c133;p=dealii-svn.git CMake: Split library lists depending on optimized, debug or general keywords git-svn-id: https://svn.dealii.org/trunk@30389 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/cmake/config/CMakeLists.txt b/deal.II/cmake/config/CMakeLists.txt index 2ecb9a7ac9..8d04799bc1 100644 --- a/deal.II/cmake/config/CMakeLists.txt +++ b/deal.II/cmake/config/CMakeLists.txt @@ -76,8 +76,8 @@ FOREACH(_build ${DEAL_II_BUILD_TYPES}) SET(CONFIG_LIBRARIES_${_build} \${DEAL_II_PATH}/\${DEAL_II_LIBRARY_RELDIR}/${CONFIG_LIBRARY_${_build}} - ${DEAL_II_EXTERNAL_LIBRARIES} ${DEAL_II_EXTERNAL_LIBRARIES_${_build}} + ${DEAL_II_EXTERNAL_LIBRARIES} ) LIST(APPEND CONFIG_LIBRARIES ${_keyword} @@ -172,8 +172,8 @@ IF(DEAL_II_COMPONENT_COMPAT_FILES) # SET(_libs) FOREACH(_lib - ${DEAL_II_EXTERNAL_LIBRARIES} ${DEAL_II_EXTERNAL_LIBRARIES_${build}} + ${DEAL_II_EXTERNAL_LIBRARIES} ) IF(_lib MATCHES "^/") LIST(APPEND _libs "${_lib}") @@ -188,8 +188,8 @@ IF(DEAL_II_COMPONENT_COMPAT_FILES) SET(_paths) FOREACH(_lib $(D)/${DEAL_II_LIBRARY_RELDIR}/${CONFIG_LIBRARY_${build}} - ${DEAL_II_EXTERNAL_LIBRARIES} ${DEAL_II_EXTERNAL_LIBRARIES_${build}} + ${DEAL_II_EXTERNAL_LIBRARIES} ) LIST(APPEND MAKEFILE_LIBS_${build} ${_lib}) # diff --git a/deal.II/cmake/configure/configure_1_lapack.cmake b/deal.II/cmake/configure/configure_1_lapack.cmake index 455a4944b4..7c64e0dbe9 100644 --- a/deal.II/cmake/configure/configure_1_lapack.cmake +++ b/deal.II/cmake/configure/configure_1_lapack.cmake @@ -83,7 +83,7 @@ ENDMACRO() MACRO(FEATURE_LAPACK_CONFIGURE_EXTERNAL) ADD_FLAGS(DEAL_II_LINKER_FLAGS "${LAPACK_LINKER_FLAGS}") - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${LAPACK_LIBRARIES}) + DEAL_II_APPEND_LIBRARIES(${LAPACK_LIBRARIES}) CHECK_FOR_LAPACK_FUNCTIONS() ENDMACRO() diff --git a/deal.II/cmake/configure/configure_1_mpi.cmake b/deal.II/cmake/configure/configure_1_mpi.cmake index 2eb6bd3847..5140848840 100644 --- a/deal.II/cmake/configure/configure_1_mpi.cmake +++ b/deal.II/cmake/configure/configure_1_mpi.cmake @@ -95,7 +95,7 @@ MACRO(FEATURE_MPI_CONFIGURE_EXTERNAL) ADD_FLAGS(CMAKE_CXX_FLAGS "${MPI_CXX_COMPILE_FLAGS}") ADD_FLAGS(DEAL_II_LINKER_FLAGS "${MPI_CXX_LINK_FLAGS}") - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${MPI_CXX_LIBRARIES}) + DEAL_II_APPEND_LIBRARIES(${MPI_CXX_LIBRARIES}) INCLUDE_DIRECTORIES(${MPI_CXX_INCLUDE_PATH}) # The user has to know the location of the mpi headers as well: diff --git a/deal.II/cmake/configure/configure_1_threads.cmake b/deal.II/cmake/configure/configure_1_threads.cmake index d43fd3ea49..e6ddef4076 100644 --- a/deal.II/cmake/configure/configure_1_threads.cmake +++ b/deal.II/cmake/configure/configure_1_threads.cmake @@ -153,7 +153,7 @@ ENDMACRO() MACRO(FEATURE_THREADS_CONFIGURE_EXTERNAL) INCLUDE_DIRECTORIES(${TBB_INCLUDE_DIR}) - SPLIT_DEBUG_RELEASE(_tbb_debug _tbb_release ${TBB_LIBRARIES}) + DEAL_II_APPEND_LIBRARIES(${TBB_LIBRARIES}) IF(CMAKE_BUILD_TYPE MATCHES "Debug") IF(TBB_WITH_DEBUG_LIB) @@ -162,12 +162,8 @@ MACRO(FEATURE_THREADS_CONFIGURE_EXTERNAL) ) ENDIF() - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES_DEBUG ${_tbb_debug}) ENDIF() - IF(CMAKE_BUILD_TYPE MATCHES "Release") - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES_RELEASE ${_tbb_release}) - ENDIF() SETUP_THREADING() ENDMACRO() @@ -200,7 +196,7 @@ MACRO(FEATURE_THREADS_CONFIGURE_BUNDLED) FIND_LIBRARY(dl_LIBRARY NAMES dl) MARK_AS_ADVANCED(dl_LIBRARY) IF(NOT dl_LIBRARY MATCHES "-NOTFOUND") - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${dl_LIBRARY}) + DEAL_II_APPEND_LIBRARIES(${dl_LIBRARY}) ENDIF() INCLUDE_DIRECTORIES(${TBB_FOLDER}/include) diff --git a/deal.II/cmake/configure/configure_2_petsc.cmake b/deal.II/cmake/configure/configure_2_petsc.cmake index a78757796a..77e5c320cc 100644 --- a/deal.II/cmake/configure/configure_2_petsc.cmake +++ b/deal.II/cmake/configure/configure_2_petsc.cmake @@ -115,7 +115,7 @@ MACRO(FEATURE_PETSC_CONFIGURE_EXTERNAL) # The user has to know the location of the petsc headers as well: LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${PETSC_INCLUDE_DIRS}) - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${PETSC_LIBRARIES}) + DEAL_II_APPEND_LIBRARIES(${PETSC_LIBRARIES}) # # Disable a bunch of warnings when compiling with petsc: diff --git a/deal.II/cmake/configure/configure_2_trilinos.cmake b/deal.II/cmake/configure/configure_2_trilinos.cmake index 3669492796..8b8ce3aee2 100644 --- a/deal.II/cmake/configure/configure_2_trilinos.cmake +++ b/deal.II/cmake/configure/configure_2_trilinos.cmake @@ -191,7 +191,7 @@ MACRO(FEATURE_TRILINOS_CONFIGURE_EXTERNAL) # The user has to know the location of the trilinos headers as well: LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${TRILINOS_INCLUDE_DIRS}) - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${TRILINOS_LIBRARIES}) + DEAL_II_APPEND_LIBRARIES(${TRILINOS_LIBRARIES}) SET(DEAL_II_EXPAND_TRILINOS_VECTOR "TrilinosWrappers::Vector") SET(DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR "TrilinosWrappers::BlockVector") diff --git a/deal.II/cmake/configure/configure_boost.cmake b/deal.II/cmake/configure/configure_boost.cmake index 7b8ee48ed0..b6ed7c3b2c 100644 --- a/deal.II/cmake/configure/configure_boost.cmake +++ b/deal.II/cmake/configure/configure_boost.cmake @@ -26,7 +26,7 @@ IF(NOT FEATURE_THREADS_PROCESSED) MESSAGE(FATAL_ERROR "\n" "Internal build system error:\n" - "configure_boost.cmake included before configure_tbb.cmake\n\n" + "configure_boost.cmake included before configure_1_threads.cmake\n\n" ) ENDIF() @@ -108,19 +108,8 @@ MACRO(FEATURE_BOOST_CONFIGURE_EXTERNAL) # LIST(REMOVE_ITEM Boost_LIBRARIES "pthread") - # - # Transform Boost_LIBRARIES into a list of debug and release libraries - # without keywords: - # - SPLIT_DEBUG_RELEASE(_boost_debug _boost_release ${Boost_LIBRARIES}) + DEAL_II_APPEND_LIBRARIES(${Boost_LIBRARIES}) - IF (CMAKE_BUILD_TYPE MATCHES "Debug") - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES_DEBUG ${_boost_debug}) - ENDIF() - - IF (CMAKE_BUILD_TYPE MATCHES "Release") - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES_RELEASE ${_boost_release}) - ENDIF() ENDMACRO() diff --git a/deal.II/cmake/configure/configure_mumps.cmake b/deal.II/cmake/configure/configure_mumps.cmake index f4a9a27446..0739098602 100644 --- a/deal.II/cmake/configure/configure_mumps.cmake +++ b/deal.II/cmake/configure/configure_mumps.cmake @@ -26,7 +26,7 @@ MACRO(FEATURE_MUMPS_CONFIGURE_EXTERNAL) # The user has to know the location of the MUMPS headers as well: LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${MUMPS_INCLUDE_DIRS}) - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${MUMPS_LIBRARIES}) + DEAL_II_APPEND_LIBRARIES(${MUMPS_LIBRARIES}) ENDMACRO() CONFIGURE_FEATURE(MUMPS) diff --git a/deal.II/cmake/configure/configure_p4est.cmake b/deal.II/cmake/configure/configure_p4est.cmake index 3773a88b12..156d5b28b3 100644 --- a/deal.II/cmake/configure/configure_p4est.cmake +++ b/deal.II/cmake/configure/configure_p4est.cmake @@ -55,7 +55,7 @@ MACRO(FEATURE_P4EST_CONFIGURE_EXTERNAL) # The user has to know the location of the P4EST headers as well: LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${P4EST_INCLUDE_DIRS}) - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${P4EST_LIBRARIES}) + DEAL_II_APPEND_LIBRARIES(${P4EST_LIBRARIES}) ENDMACRO() CONFIGURE_FEATURE(P4EST) diff --git a/deal.II/cmake/configure/configure_slepc.cmake b/deal.II/cmake/configure/configure_slepc.cmake index c0d1b212b0..3a4d42624a 100644 --- a/deal.II/cmake/configure/configure_slepc.cmake +++ b/deal.II/cmake/configure/configure_slepc.cmake @@ -62,7 +62,7 @@ MACRO(FEATURE_SLEPC_CONFIGURE_EXTERNAL) # The user has to know the location of the SLEPC headers as well: LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${SLEPC_INCLUDE_DIRS}) - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${SLEPC_LIBRARIES}) + DEAL_II_APPEND_LIBRARIES(${SLEPC_LIBRARIES}) ENDMACRO() diff --git a/deal.II/cmake/macros/macro_configure_feature.cmake b/deal.II/cmake/macros/macro_configure_feature.cmake index 0ae79de3c0..0ffbf4fb10 100644 --- a/deal.II/cmake/macros/macro_configure_feature.cmake +++ b/deal.II/cmake/macros/macro_configure_feature.cmake @@ -142,7 +142,7 @@ MACRO(FEATURE_CONFIGURE_EXTERNAL _feature) INCLUDE_DIRECTORIES(${${_feature}_INCLUDE_DIRS}) ENDIF() IF(DEFINED ${_feature}_LIBRARIES) - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${${_feature}_LIBRARIES}) + DEAL_II_APPEND_LIBRARIES(${${_feature}_LIBRARIES}) ENDIF() IF(DEFINED ${_feature}_LINKER_FLAGS) ADD_FLAGS(DEAL_II_LINKER_FLAGS "${${_feature}_LINKER_FLAGS}") diff --git a/deal.II/cmake/macros/macro_deal_ii_append_libraries.cmake b/deal.II/cmake/macros/macro_deal_ii_append_libraries.cmake new file mode 100644 index 0000000000..de291d39b6 --- /dev/null +++ b/deal.II/cmake/macros/macro_deal_ii_append_libraries.cmake @@ -0,0 +1,47 @@ +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2013 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- + +# +# A small macro to add libraries to +# DEAL_II_EXTERNAL_LIBRARIES +# DEAL_II_EXTERNAL_LIBRARIES_DEBUG +# DEAL_II_EXTERNAL_LIBRARIES_RELEASE +# depending on the "optmized", "debug" or "general" keyword +# +# Usage: +# DEAL_II_APPEND_LIBRARIES() +# + +MACRO(DEAL_II_APPEND_LIBRARIES) + + SET(_toggle "general") + FOREACH(_tmp ${ARGN}) + IF( "${_tmp}" STREQUAL "debug" OR + "${_tmp}" STREQUAL "optimized" OR + "${_tmp}" STREQUAL "general" ) + SET(_toggle "${_tmp}") + ELSE() + IF("${_toggle}" STREQUAL "general") + LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${_tmp}) + ELSEIF("${_toggle}" STREQUAL "debug") + LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES_DEBUG ${_tmp}) + ELSEIF("${_toggle}" STREQUAL "optimized") + LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES_RELEASE ${_tmp}) + ENDIF() + ENDIF() + ENDFOREACH() + +ENDMACRO() diff --git a/deal.II/source/CMakeLists.txt b/deal.II/source/CMakeLists.txt index 96c55ff3db..bab0c9796e 100644 --- a/deal.II/source/CMakeLists.txt +++ b/deal.II/source/CMakeLists.txt @@ -85,8 +85,8 @@ FOREACH(build ${DEAL_II_BUILD_TYPES}) ) TARGET_LINK_LIBRARIES(${DEAL_II_BASE_NAME}${DEAL_II_${build}_SUFFIX} - ${DEAL_II_EXTERNAL_LIBRARIES} ${DEAL_II_EXTERNAL_LIBRARIES_${build}} + ${DEAL_II_EXTERNAL_LIBRARIES} ) INSTALL(TARGETS ${DEAL_II_BASE_NAME}${DEAL_II_${build}_SUFFIX}