From: Matthias Maier Date: Mon, 23 Sep 2013 15:23:24 +0000 (+0000) Subject: Remove the out-of-source check from DEAL_II_INVOKE_AUTOPILOT X-Git-Tag: v8.1.0~746 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=432ee949dd35c49209f299ebd16a24a120c68716;p=dealii.git Remove the out-of-source check from DEAL_II_INVOKE_AUTOPILOT git-svn-id: https://svn.dealii.org/trunk@30895 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/cmake/macros/macro_deal_ii_invoke_autopilot.cmake b/deal.II/cmake/macros/macro_deal_ii_invoke_autopilot.cmake index 4391d4bcf0..a418855339 100644 --- a/deal.II/cmake/macros/macro_deal_ii_invoke_autopilot.cmake +++ b/deal.II/cmake/macros/macro_deal_ii_invoke_autopilot.cmake @@ -42,97 +42,89 @@ MACRO(DEAL_II_INVOKE_AUTOPILOT) ADD_EXECUTABLE(${TARGET} ${TARGET_SRC}) DEAL_II_SETUP_TARGET(${TARGET}) - IF(NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") - MESSAGE(STATUS - "Out-of-source build. Target ${TARGET} defined but additional " - "autopilot funcionality is not available." - ) + MESSAGE(STATUS "Autopilot invoked") - ELSE() + # Define a custom target to easily run the program: - MESSAGE(STATUS "Autopilot invoked") - - # Define a custom target to easily run the program: - - IF(NOT DEFINED TARGET_RUN) - SET(TARGET_RUN ${TARGET}) - ENDIF() - - # - # Hack for Cygwin targets: Export PATH to point to the dynamic library. - # This is more or less harmless, so do this unconditionally. - # - FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/run_target.cmake - "SET(ENV{PATH} \"${CMAKE_CURRENT_BINARY_DIR}:${DEAL_II_PATH}/${DEAL_II_LIBRARY_RELDIR}:\$ENV{PATH}\")\n" - "EXECUTE_PROCESS(COMMAND ${TARGET_RUN}\n" - " RESULT_VARIABLE _return_value\n" - " )\n" - "IF(NOT \"\${_return_value}\" STREQUAL "0")\n" - " MESSAGE(SEND_ERROR \"\nProgram terminated with exit code: \${_return_value}\")\n" - "ENDIF()\n" - ) - IF(NOT "${TARGET_RUN}" STREQUAL "") - ADD_CUSTOM_TARGET(run - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/run_target.cmake - DEPENDS ${TARGET} - COMMENT "Run ${TARGET} with ${CMAKE_BUILD_TYPE} configuration" - ) - SET(_run_targets - "# $ make run - to (compile, link and) run the program\n" - ) - ENDIF() - - # Define custom targets to easily switch the build type: - ADD_CUSTOM_TARGET(debug - COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR} - COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all - COMMENT "Switch CMAKE_BUILD_TYPE to Debug" - ) + IF(NOT DEFINED TARGET_RUN) + SET(TARGET_RUN ${TARGET}) + ENDIF() - ADD_CUSTOM_TARGET(release - COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR} - COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all - COMMENT "Switch CMAKE_BUILD_TYPE to Release" + # + # Hack for Cygwin targets: Export PATH to point to the dynamic library. + # This is more or less harmless, so do this unconditionally. + # + FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/run_target.cmake + "SET(ENV{PATH} \"${CMAKE_CURRENT_BINARY_DIR}:${DEAL_II_PATH}/${DEAL_II_LIBRARY_RELDIR}:\$ENV{PATH}\")\n" + "EXECUTE_PROCESS(COMMAND ${TARGET_RUN}\n" + " RESULT_VARIABLE _return_value\n" + " )\n" + "IF(NOT \"\${_return_value}\" STREQUAL "0")\n" + " MESSAGE(SEND_ERROR \"\nProgram terminated with exit code: \${_return_value}\")\n" + "ENDIF()\n" + ) + IF(NOT "${TARGET_RUN}" STREQUAL "") + ADD_CUSTOM_TARGET(run + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/run_target.cmake + DEPENDS ${TARGET} + COMMENT "Run ${TARGET} with ${CMAKE_BUILD_TYPE} configuration" + ) + SET(_run_targets + "# $ make run - to (compile, link and) run the program\n" ) + ENDIF() - # Only mention release and debug targets if it is actuallay possible to - # switch between them: - IF(${DEAL_II_BUILD_TYPE} MATCHES "DebugRelease") - SET(_switch_targets + # Define custom targets to easily switch the build type: + ADD_CUSTOM_TARGET(debug + COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR} + COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all + COMMENT "Switch CMAKE_BUILD_TYPE to Debug" + ) + + ADD_CUSTOM_TARGET(release + COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR} + COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all + COMMENT "Switch CMAKE_BUILD_TYPE to Release" + ) + + # Only mention release and debug targets if it is actuallay possible to + # 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" - ) - ENDIF() - - # And another custom target to clean up all files generated by the program: - IF("${CLEAN_UP_FILES}" STREQUAL "") - SET(CLEAN_UP_FILES *.log *.gmv *.gnuplot *.gpl *.eps *.pov *.vtk *.ucd *.d2) - ENDIF() - ADD_CUSTOM_TARGET(runclean - COMMAND ${CMAKE_COMMAND} -E remove ${CLEAN_UP_FILES} - COMMENT "runclean invoked" ) + ENDIF() - # Define a distclean target to remove every generated file: - ADD_CUSTOM_TARGET(distclean - COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target clean - COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target runclean - COMMAND ${CMAKE_COMMAND} -E remove_directory CMakeFiles - COMMAND ${CMAKE_COMMAND} -E remove CMakeCache.txt cmake_install.cmake Makefile - COMMENT "distclean invoked" + # And another custom target to clean up all files generated by the program: + IF("${CLEAN_UP_FILES}" STREQUAL "") + SET(CLEAN_UP_FILES *.log *.gmv *.gnuplot *.gpl *.eps *.pov *.vtk *.ucd *.d2) + ENDIF() + ADD_CUSTOM_TARGET(runclean + COMMAND ${CMAKE_COMMAND} -E remove ${CLEAN_UP_FILES} + COMMENT "runclean invoked" + ) + + # Define a distclean target to remove every generated file: + ADD_CUSTOM_TARGET(distclean + COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target clean + COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target runclean + COMMAND ${CMAKE_COMMAND} -E remove_directory CMakeFiles + COMMAND ${CMAKE_COMMAND} -E remove CMakeCache.txt cmake_install.cmake Makefile + COMMENT "distclean invoked" + ) + + # Define a strip-comments target: + FIND_PACKAGE(Perl QUIET) + IF(PERL_FOUND) + ADD_CUSTOM_TARGET(strip_comments + COMMAND ${PERL_EXECUTABLE} -pi -e 's\#^[ \\t]*//.*\\n\#\#g;' ${TARGET_SRC} + COMMENT "strip comments" ) + ENDIF() - # Define a strip-comments target: - FIND_PACKAGE(Perl QUIET) - IF(PERL_FOUND) - ADD_CUSTOM_TARGET(strip_comments - COMMAND ${PERL_EXECUTABLE} -pi -e 's\#^[ \\t]*//.*\\n\#\#g;' ${TARGET_SRC} - COMMENT "strip comments" - ) - ENDIF() - - # Print out some usage information to file: - FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_usage.cmake + # Print out some usage information to file: + FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_usage.cmake "MESSAGE( \"### # @@ -162,21 +154,19 @@ ${_switch_targets}# # Have a nice day! # ###\")" - ) + ) - # A custom target to print the message: - ADD_CUSTOM_TARGET(help - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_usage.cmake - ) - - # 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") - ENDIF() + # A custom target to print the message: + ADD_CUSTOM_TARGET(help + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_usage.cmake + ) + # 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") ENDIF() ENDMACRO()