]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: Cosmetic fixes wrt CMP0037 in CMake-3.0.0
authorMatthias Maier <tamiko@kyomu.43-1.org>
Tue, 17 Jun 2014 12:56:38 +0000 (12:56 +0000)
committerMatthias Maier <tamiko@kyomu.43-1.org>
Tue, 17 Jun 2014 12:56:38 +0000 (12:56 +0000)
 - Suppress policy warning CMP0037 when using CMake-3.0.0, or newer
 - restrict target redefinition to ".*Unix Makefiles" Generators
 - Cleanup help messages to advertise "make info" instead of "make help"

git-svn-id: https://svn.dealii.org/trunk@33055 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/CMakeLists.txt
deal.II/cmake/macros/macro_deal_ii_invoke_autopilot.cmake
deal.II/cmake/setup_custom_targets.cmake
deal.II/cmake/setup_write_config.cmake

index 3b5c72425849d707ae0aeb9e04afd7a1ed5f33ee..4b0913a50c5bfc3273b4201f0a4c420857a3555d 100644 (file)
@@ -32,6 +32,8 @@
 # General configuration for cmake:
 #
 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)
+CMAKE_POLICY(VERSION 2.8.8)
+
 MESSAGE(STATUS "This is CMake ${CMAKE_VERSION}")
 
 LIST(APPEND CMAKE_MODULE_PATH
index 323a2b229d835af7c477e5ef32d677ac9a0db0c3..1a07962f5c183739fb1c1972dbee0abb78783b56 100644 (file)
 #                         empty
 #
 
+CMAKE_POLICY(PUSH)
+CMAKE_POLICY(VERSION 2.8.8)
+
 MACRO(DEAL_II_INVOKE_AUTOPILOT)
 
   # Generator specific values:
   IF(CMAKE_GENERATOR MATCHES "Ninja")
-    #
-    # Ninja doesn't like a redefinition of the "help" target, so use "info"
-    # in this case...
-    #
     SET(_make_command "$ ninja")
   ELSE()
     SET(_make_command " $ make")
@@ -209,40 +208,35 @@ ${_switch_targets}#
 #
 ")
   ENDIF()
-  FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_usage.cmake
+  IF(PERL_FOUND)
+    FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_usage.cmake
 "#      ${_make_command} strip_comments - to strip the source files in this
 #                               directory off the documentation comments
-#      ${_make_command} clean          - to remove the generated executable as well as
+")
+  ENDIF()
+  FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_usage.cmake
+"#      ${_make_command} clean          - to remove the generated executable as well as
 #                               all intermediate compilation files
 #      ${_make_command} runclean       - to remove all output generated by the program
 #      ${_make_command} distclean      - to clean the directory from _all_ generated
 #                               files (includes clean, runclean and the removal
 #                               of the generated build system)
+#      ${_make_command} info           - to view this message again
 #
-"
-    )
-   IF(CMAKE_GENERATOR MATCHES "Ninja")
-     FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_usage.cmake
-"#      $ ninja info           - to view this message again
-"
-       )
-   ELSE()
-     FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_usage.cmake
-"#       $ make help           - to view this message again
-"      )
-   ENDIF()
-   FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_usage.cmake
-"#
 #  Have a nice day!
 #
 ###\")"
      )
 
-  # A custom target to print the message:
   ADD_CUSTOM_TARGET(info
     COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_usage.cmake
     )
-  IF(NOT CMAKE_GENERATOR MATCHES "Ninja")
+
+  #
+  # 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
       )
@@ -253,12 +247,10 @@ ${_switch_targets}#
     INCLUDE(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_usage.cmake)
     SET(USAGE_PRINTED TRUE CACHE INTERNAL "")
   ELSE()
-    IF(CMAKE_GENERATOR MATCHES "Ninja")
-      MESSAGE(STATUS "Run  $ ninja info  to print a detailed help message")
-    ELSE()
-      MESSAGE(STATUS "Run  $ make help  to print a detailed help message")
-    ENDIF()
+    MESSAGE(STATUS "Run  ${_make_command} info  to print a detailed help message")
   ENDIF()
 
 ENDMACRO()
 
+CMAKE_POLICY(POP)
+
index dbe20b221e909e449cb27ea23461939c017aef74..fcb3fbc127ca2bdc07f4261b6cf87a85d54d4178 100644 (file)
@@ -80,12 +80,12 @@ ENDFOREACH()
 #
 # Provide an "info" target to print a help message:
 #
-
 IF(CMAKE_GENERATOR MATCHES "Ninja")
   SET(_make_command "ninja")
 ELSE()
   SET(_make_command "make")
 ENDIF()
+
 FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_info.cmake
 "MESSAGE(
 \"###
@@ -105,7 +105,7 @@ IF(CMAKE_GENERATOR MATCHES "Ninja")
 ")
 ELSE()
   FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_info.cmake
-"#    help           - print this help message in the toplevel directory,
+"#    info           - print this help message in the toplevel directory,
 #                     otherwise print a list of targets (in subdirectories)
 #
 ")
@@ -125,8 +125,8 @@ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_info.cmake
 #
 #    test           - run a minimal set of tests
 #
-#    setup_tests    - set up the testsuite subprojects
-#    regen_tests    - rerun configure stage in every testsuite subprojects
+#    setup_tests    - set up testsuite subprojects
+#    regen_tests    - rerun configure stage in every testsuite subproject
 #    clean_tests    - run the 'clean' target in every testsuite subproject
 #    prune_tests    - remove all testsuite subprojects
 #
@@ -136,7 +136,12 @@ 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
   )
-IF(NOT CMAKE_GENERATOR MATCHES "Ninja")
+
+#
+# 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
     )
index 38c03515351d6108b5e7dff92c35eb0a87b2df1c..019e5f8d9ff85cc18d86aacd032eb156df6d581b 100644 (file)
@@ -227,10 +227,10 @@ _summary(
 #\n#  Run  $ "
   )
 IF(CMAKE_GENERATOR MATCHES "Ninja")
-  _summary("ninja info")
+  _summary("ninja ")
 ELSE()
-_summary("make help")
+_summary("make ")
 ENDIF()
-_summary("  to print a help message with a list of top level targets\n")
+_summary("info  to print a help message with a list of top level targets\n")
 
 _both("#\n###")

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.