MACRO(DEAL_II_INVOKE_AUTOPILOT)
+ # Generator specific values:
+ IF(CMAKE_GENERATOR MATCHES "Ninja")
+ #
+ # Ninja doesn't like a redifinition of the "help" target, so use "info"
+ # in this case...
+ #
+ SET(_make_command "$ ninja")
+ ELSE()
+ SET(_make_command " $ make")
+ ENDIF()
+
# Define and setup a compilation target:
ADD_EXECUTABLE(${TARGET} ${TARGET_SRC})
DEAL_II_SETUP_TARGET(${TARGET})
COMMENT "Run ${TARGET} with ${CMAKE_BUILD_TYPE} configuration"
)
SET(_run_targets
- "# $ make run - to (compile, link and) run the program\n"
+ "# ${_make_command} run - to (compile, link and) run the program\n"
)
ENDIF()
ENDIF()
SET(_run_targets
- "${_run_targets}#\n# $ make sign - to sign the executable with the supplied OSX developer key\n"
+ "${_run_targets}#\n# ${_make_command} sign - to sign the executable with the supplied OSX developer key\n"
)
ENDIF()
# switch between them:
IF(${DEAL_II_BUILD_TYPE} MATCHES "DebugRelease")
SET(_switch_targets
-"# $ make debug - to switch the build type to \"Debug\"
-# $ make release - to switch the build type to \"Release\"\n"
+"# ${_make_command} debug - to switch the build type to \"Debug\"
+# ${_make_command} release - to switch the build type to \"Release\"\n"
)
ENDIF()
)
ENDIF()
+
# Print out some usage information to file:
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_usage.cmake
"MESSAGE(
\"###
#
-# Successfully set up project ${TARGET} with ${DEAL_II_PACKAGE_NAME}-${DEAL_II_PACKAGE_VERSION} found at
+# Project ${TARGET} set up with ${DEAL_II_PACKAGE_NAME}-${DEAL_II_PACKAGE_VERSION} found at
# ${DEAL_II_PATH}
#
-# CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}
+# CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}
#
# You can now run
-# $ make - to compile and link the program
+# ${_make_command} - to compile and link the program
${_run_targets}#
${_switch_targets}#
-# $ make edit_cache - to change (cached) configuration variables
-# and rerun the configure and generate phases of CMake
-#
-# $ make strip_comments - to strip the source files in this
-# directory off the documentation comments
-# $ make clean - to remove the generated executable as well as
-# all intermediate compilation files
-# $ make runclean - to remove all output generated by the program
-# $ make distclean - to clean the directory from _all_ generated
-# files (includes clean, runclean and the removal
-# of the generated build system)
+")
+ IF(NOT CMAKE_GENERATOR MATCHES "Ninja")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_usage.cmake
+"# ${_make_command} edit_cache - to change (cached) configuration variables
+# and rerun the configure and generate phases of CMake
#
-# $ make help - to view this message again
+")
+ ENDIF()
+ 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
+# 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)
#
+"
+ )
+ 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(help
+ ADD_CUSTOM_TARGET(info
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_usage.cmake
)
+ IF(NOT CMAKE_GENERATOR MATCHES "Ninja")
+ 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)
SET(USAGE_PRINTED TRUE CACHE INTERNAL "")
ELSE()
- MESSAGE(STATUS "Run $ make help to print a detailed help message")
+ 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()
ENDIF()
ENDMACRO()
# 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(
\"###
#
-# The following targets are available (invoke by $ make <target>):
+# The following targets are available (invoke by $ ${_make_command} <target>):
#
# all - compiles the library and all enabled components
# clean - removes all generated files
# install - installs into CMAKE_INSTALL_PREFIX
+")
+
+IF(CMAKE_GENERATOR MATCHES "Ninja")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_info.cmake
+"# info - prints this help message
# help - prints a list of valid top level targets
-# info - prints this help message
#
-# edit_cache - runs ccmake for changing (cached) configuration variables
+")
+ELSE()
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_info.cmake
+"# help - prints this help message in the toplevel directory,
+# otherwise prints a list of targets (in subdirectories)
+#
+")
+ENDIF()
+
+FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_info.cmake
+"# edit_cache - runs ccmake for changing (cached) configuration variables
# and reruns the configure and generate phases of CMake
# rebuild_cache - reruns the configure and generate phases of CMake
#
#
###\")"
)
+
ADD_CUSTOM_TARGET(info
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_info.cmake
)
+IF(NOT CMAKE_GENERATOR MATCHES "Ninja")
+ ADD_CUSTOM_TARGET(help
+ COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_info.cmake
+ )
+ENDIF()