From: maier Date: Sat, 29 Sep 2012 09:44:41 +0000 (+0000) Subject: OK. It is much better to do it the cmake way... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4969758052de0315fc7249aac78584fbcffdd99f;p=dealii-svn.git OK. It is much better to do it the cmake way... git-svn-id: https://svn.dealii.org/branches/branch_cmake@26882 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake b/deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake index c90523e043..b3ed90c29f 100644 --- a/deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake +++ b/deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake @@ -13,6 +13,14 @@ MACRO(DEAL_II_INITIALIZE_CACHED_VARIABLES) + IF(NOT DEAL_II_PROJECT_CONFIG_INCLUDE) + MESSAGE(FATAL_ERROR + "DEAL_II_INITIALIZE_CACHED_VARIABLES can only be called in external " + "projects after the inclusion of deal.IIConfig.cmake. It is not " + "intended for internal use." + ) + ENDIF() + SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build, options are: Debug, Release" ) diff --git a/deal.II/cmake/macros/macro_deal_ii_setup_target.cmake b/deal.II/cmake/macros/macro_deal_ii_setup_target.cmake index 022df90310..f4afcd78ee 100644 --- a/deal.II/cmake/macros/macro_deal_ii_setup_target.cmake +++ b/deal.II/cmake/macros/macro_deal_ii_setup_target.cmake @@ -11,6 +11,14 @@ MACRO(DEAL_II_SETUP_TARGET target) + IF(NOT DEAL_II_PROJECT_CONFIG_INCLUDE) + MESSAGE(FATAL_ERROR + "DEAL_II_SETUP_TARGET can only be called in external projects after " + "the inclusion of deal.IIConfig.cmake. It is not intended for " + "internal use." + ) + ENDIF() + CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) SET_TARGET_PROPERTIES(${target} PROPERTIES @@ -30,28 +38,10 @@ MACRO(DEAL_II_SETUP_TARGET target) "${DEAL_II_USER_DEFINITIONS_RELEASE}" ) - IF(NOT "${DEAL_II_LIBRARIES_DEBUG}${DEAL_II_EXTERNAL_LIBRARIES_DEBUG}" STREQUAL "") - TARGET_LINK_LIBRARIES(${target} - debug - ${DEAL_II_LIBRARIES_DEBUG} - ${DEAL_II_EXTERNAL_LIBRARIES_DEBUG} - ) - ENDIF() - - IF(NOT "${DEAL_II_LIBRARIES_RELEASE}${DEAL_II_EXTERNAL_LIBRARIES_RELEASE}" STREQUAL "") - TARGET_LINK_LIBRARIES(${target} - optimized - ${DEAL_II_LIBRARIES_RELEASE} - ${DEAL_II_EXTERNAL_LIBRARIES_RELEASE} - ) - ENDIF() - - IF(NOT "${DEAL_II_EXTERNAL_LIBRARIES}" STREQUAL "") TARGET_LINK_LIBRARIES(${target} - general + ${DEAL_II_LIBRARIES} ${DEAL_II_EXTERNAL_LIBRARIES} ) - ENDIF() ENDMACRO() diff --git a/deal.II/cmake/setup_deal_ii.cmake b/deal.II/cmake/setup_deal_ii.cmake index 3f2dfb7bbd..cf3ee14316 100644 --- a/deal.II/cmake/setup_deal_ii.cmake +++ b/deal.II/cmake/setup_deal_ii.cmake @@ -115,7 +115,7 @@ IF(CMAKE_BUILD_TYPE MATCHES "Debug") "${CMAKE_INSTALL_PREFIX}/${DEAL_II_LIBRARY_RELDIR}/${DEAL_II_LIBRARY_NAME_DEBUG}" ) LIST(APPEND DEAL_II_LIBRARIES - DEBUG + debug "${CMAKE_INSTALL_PREFIX}/${DEAL_II_LIBRARY_RELDIR}/${DEAL_II_LIBRARY_NAME_DEBUG}" ) @@ -127,16 +127,13 @@ IF(CMAKE_BUILD_TYPE MATCHES "Release") "${CMAKE_INSTALL_PREFIX}/${DEAL_II_LIBRARY_RELDIR}/${DEAL_II_LIBRARY_NAME_RELEASE}" ) LIST(APPEND DEAL_II_LIBRARIES - RELEASE + optimized "${CMAKE_INSTALL_PREFIX}/${DEAL_II_LIBRARY_RELDIR}/${DEAL_II_LIBRARY_NAME_RELEASE}" ) LIST(APPEND DEAL_II_BUILD_TYPES "RELEASE") ENDIF() -# -# TODO: Remove this hack. -# FOREACH(build ${DEAL_II_BUILD_TYPES}) STRING(TOLOWER "${build}" build_lowercase) FILE(REMOVE diff --git a/deal.II/config/CMakeLists.txt b/deal.II/config/CMakeLists.txt index 3da5233bed..72530c42d7 100644 --- a/deal.II/config/CMakeLists.txt +++ b/deal.II/config/CMakeLists.txt @@ -26,6 +26,33 @@ IF(DEAL_II_COMPONENT_PROJECT_CONFIG) # Configure and install the cmake project configuration: # + SET(CONFIG_EXTERNAL_LIBRARIES + general + ${DEAL_II_EXTERNAL_LIBRARIES} + ) + + IF(CMAKE_BUILD_TYPE MATCHES "Debug") + SET(CONFIG_EXTERNAL_LIBRARIES_DEBUG + ${DEAL_II_EXTERNAL_LIBRARIES} + ${DEAL_II_EXTERNAL_LIBRARIES_DEBUG} + ) + LIST(APPEND CONFIG_LIBRARIES + debug + ${DEAL_II_EXTERNAL_LIBRARIES_DEBUG} + ) + ENDIF() + + IF(CMAKE_BUILD_TYPE MATCHES "Release") + SET(CONFIG_EXTERNAL_LIBRARIES_RELEASE + ${DEAL_II_EXTERNAL_LIBRARIES} + ${DEAL_II_EXTERNAL_LIBRARIES_RELEASE} + ) + LIST(APPEND CONFIG_LIBRARIES + optimized + ${DEAL_II_EXTERNAL_LIBRARIES_RELEASE} + ) + ENDIF() + CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake diff --git a/deal.II/config/Config.cmake.in b/deal.II/config/Config.cmake.in index a8a4298ff9..e921c0d2ad 100644 --- a/deal.II/config/Config.cmake.in +++ b/deal.II/config/Config.cmake.in @@ -2,6 +2,8 @@ # The deal.II project configuration file # +SET(DEAL_II_PROJECT_CONFIG_INCLUDE TRUE) + # # General information @@ -57,11 +59,17 @@ SET(DEAL_II_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") SET(DEAL_II_LINKER_FLAGS_DEBUG "${DEAL_II_SHARED_LINKER_FLAGS_DEBUG}") SET(DEAL_II_LINKER_FLAGS_RELEASE "${DEAL_II_SHARED_LINKER_FLAGS_RELEASE}") +SET(DEAL_II_USER_DEFINITIONS "${DEAL_II_USER_DEFINITIONS}") +SET(DEAL_II_USER_DEFINITIONS_DEBUG "${DEAL_II_USER_DEFINITIONS_DEBUG}") +SET(DEAL_II_USER_DEFINITIONS_RELEASE "${DEAL_II_USER_DEFINITIONS_RELEASE}") + + # -# Information on where to find the deal.II libraries and headers +# Information about the the deal.II libraries and headers # SET(DEAL_II_INCLUDE_DIRS "${DEAL_II_INCLUDE_DIRS}") + SET(DEAL_II_LIBRARIES "${DEAL_II_LIBRARIES}") SET(DEAL_II_LIBRARIES_DEBUG "${DEAL_II_LIBRARIES_DEBUG}") SET(DEAL_II_LIBRARIES_RELEASE "${DEAL_II_LIBRARIES_RELEASE}") @@ -73,13 +81,9 @@ SET(DEAL_II_LIBRARIES_RELEASE "${DEAL_II_LIBRARIES_RELEASE}") SET(DEAL_II_EXTERNAL_INCLUDE_DIRS "${DEAL_II_USER_INCLUDE_DIRS}") -SET(DEAL_II_EXTERNAL_LIBRARIES "${DEAL_II_EXTERNAL_LIBRARIES}") -SET(DEAL_II_EXTERNAL_LIBRARIES_DEBUG "${DEAL_II_EXTERNAL_LIBRARIES_DEBUG}") -SET(DEAL_II_EXTERNAL_LIBRARIES_RELEASE "${DEAL_II_EXTERNAL_LIBRARIES_RELEASE}") - -SET(DEAL_II_USER_DEFINITIONS "${DEAL_II_USER_DEFINITIONS}") -SET(DEAL_II_USER_DEFINITIONS_DEBUG "${DEAL_II_USER_DEFINITIONS_DEBUG}") -SET(DEAL_II_USER_DEFINITIONS_RELEASE "${DEAL_II_USER_DEFINITIONS_RELEASE}") +SET(DEAL_II_EXTERNAL_LIBRARIES "${CONFIG_EXTERNAL_LIBRARIES}") +SET(DEAL_II_EXTERNAL_LIBRARIES_DEBUG "${CONFIG_EXTERNAL_LIBRARIES_DEBUG}") +SET(DEAL_II_EXTERNAL_LIBRARIES_RELEASE "${CONFIG_EXTERNAL_LIBRARIES_RELEASE}") #