From: Matthias Maier Date: Thu, 21 Aug 2014 17:10:48 +0000 (+0200) Subject: CMake: Remove all "help" targets X-Git-Tag: v8.2.0-rc1~188^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f9730b23f4bcbde614a262e71be802b52a7f52f;p=dealii.git CMake: Remove all "help" targets It turns out that CMAKE_PROPERTY is too buggy to be useful. We cannot set property CMP0037 to the old behavior in order to define a custom "help" target in a macro without a warning. o_O --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 72bf5f2b03..53308f7261 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,10 +31,17 @@ # # General configuration for cmake: # + CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -IF(NOT ${CMAKE_VERSION} VERSION_LESS 3.0.0) - CMAKE_POLICY(SET CMP0026 OLD) # enable target LOCATION property - CMAKE_POLICY(SET CMP0037 OLD) # allow to override the generic 'help' target + +IF(POLICY CMP0026) + # enable target LOCATION property + CMAKE_POLICY(SET CMP0026 OLD) +ENDIF() + +IF(POLICY CMP0037) + # allow to override "test" target for quick tests + CMAKE_POLICY(SET CMP0037 OLD) ENDIF() MESSAGE(STATUS "This is CMake ${CMAKE_VERSION}") diff --git a/cmake/macros/macro_deal_ii_invoke_autopilot.cmake b/cmake/macros/macro_deal_ii_invoke_autopilot.cmake index 8a25b89051..a487d39b2c 100644 --- a/cmake/macros/macro_deal_ii_invoke_autopilot.cmake +++ b/cmake/macros/macro_deal_ii_invoke_autopilot.cmake @@ -36,11 +36,6 @@ # empty # -CMAKE_POLICY(PUSH) -IF(NOT ${CMAKE_VERSION} VERSION_LESS 3.0.0) - CMAKE_POLICY(SET CMP0037 OLD) # allow to override the generic 'help' target -ENDIF() - MACRO(DEAL_II_INVOKE_AUTOPILOT) # Generator specific values: @@ -234,16 +229,6 @@ ${_switch_targets}# COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_usage.cmake ) - # - # In case of the Unix Makefiles generator it is safe to override the - # default 'help' target, which is - frankly - quite unhelpful. - # - IF(CMAKE_GENERATOR MATCHES "Unix Makefiles") - ADD_CUSTOM_TARGET(help - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_usage.cmake - ) - ENDIF() - # Print this message once: IF(NOT USAGE_PRINTED) INCLUDE(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_usage.cmake) @@ -254,5 +239,3 @@ ${_switch_targets}# ENDMACRO() -CMAKE_POLICY(POP) - diff --git a/cmake/setup_custom_targets.cmake b/cmake/setup_custom_targets.cmake index fcb3fbc127..c0323e86e2 100644 --- a/cmake/setup_custom_targets.cmake +++ b/cmake/setup_custom_targets.cmake @@ -95,24 +95,10 @@ FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_info.cmake # all - compile the library and all enabled components # clean - remove all generated files # install - install into CMAKE_INSTALL_PREFIX -") - -IF(CMAKE_GENERATOR MATCHES "Ninja") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_info.cmake -"# info - print this help message +# info - print this help message # help - print a list of valid top level targets # -") -ELSE() - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_info.cmake -"# info - print this help message in the toplevel directory, -# otherwise print a list of targets (in subdirectories) -# -") -ENDIF() - -FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_info.cmake -"# edit_cache - run ccmake for changing (cached) configuration variables +# edit_cache - run ccmake for changing (cached) configuration variables # and reruns the configure and generate phases of CMake # rebuild_cache - rerun the configure and generate phases of CMake # @@ -136,13 +122,3 @@ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_info.cmake ADD_CUSTOM_TARGET(info COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_info.cmake ) - -# -# In case of the Unix Makefiles generator it is safe to override the -# default 'help' target, which is - frankly - quite unhelpful. -# -IF(CMAKE_GENERATOR MATCHES "Unix Makefiles") - ADD_CUSTOM_TARGET(help - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_info.cmake - ) -ENDIF()