This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, next has been updated via 5734a2f6d5e26ed8d07c46e95c5a62ac73ed6384 (commit) via a6c98a177593356e500391c01751995f0de3fb2b (commit) from 8f84ab9c4fe1d9b192d5795475c95988231dd3b1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5734a2f6d5e26ed8d07c46e95c5a62ac73ed6384 commit 5734a2f6d5e26ed8d07c46e95c5a62ac73ed6384 Merge: 8f84ab9 a6c98a1 Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Apr 18 10:26:54 2016 -0400 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Mon Apr 18 10:26:54 2016 -0400 Merge topic 'teach-custom-command-crosscompiling-emulator' into next a6c98a17 Revert topic 'teach-custom-command-crosscompiling-emulator' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a6c98a177593356e500391c01751995f0de3fb2b commit a6c98a177593356e500391c01751995f0de3fb2b Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Apr 18 10:26:32 2016 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Apr 18 10:26:32 2016 -0400 Revert topic 'teach-custom-command-crosscompiling-emulator' It will be revised and restored later. diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst index 021dcad..8726b70 100644 --- a/Help/command/add_custom_command.rst +++ b/Help/command/add_custom_command.rst @@ -78,9 +78,7 @@ The options are: If ``COMMAND`` specifies an executable target (created by the :command:`add_executable` command) it will automatically be replaced - by the location of the executable created at build time. If set, the - :variable:`CMAKE_CROSSCOMPILING_EMULATOR` variable will also be prepended - to the command to allow the executable to run on the host. + by the location of the executable created at build time. (Use the ``TARGET_FILE`` :manual:`generator expression <cmake-generator-expressions(7)>` to reference an executable later in the command line.) diff --git a/Help/command/add_custom_target.rst b/Help/command/add_custom_target.rst index f67f55a..82d69db 100644 --- a/Help/command/add_custom_target.rst +++ b/Help/command/add_custom_target.rst @@ -60,9 +60,7 @@ The options are: If ``COMMAND`` specifies an executable target (created by the :command:`add_executable` command) it will automatically be replaced - by the location of the executable created at build time. If set, the - :variable:`CMAKE_CROSSCOMPILING_EMULATOR` variable will also be prepended - to the command to allow the executable to run on the host. + by the location of the executable created at build time. Additionally a target-level dependency will be added so that the executable target will be built before this custom target. diff --git a/Help/prop_tgt/CROSSCOMPILING_EMULATOR.rst b/Help/prop_tgt/CROSSCOMPILING_EMULATOR.rst index 626f339..3ef8e03 100644 --- a/Help/prop_tgt/CROSSCOMPILING_EMULATOR.rst +++ b/Help/prop_tgt/CROSSCOMPILING_EMULATOR.rst @@ -2,5 +2,5 @@ CROSSCOMPILING_EMULATOR ----------------------- Use the given emulator to run executables created when crosscompiling. This -command will be added as a prefix to :command:`add_test`, :command:`add_custom_command` -and :command:`add_custom_target` commands for built target system executables. +command will be added as a prefix to :command:`add_test` test commands for +built target system executables. diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index 238fd66..dc06678 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -39,39 +39,6 @@ unsigned int cmCustomCommandGenerator::GetNumberOfCommands() const } //---------------------------------------------------------------------------- -const char* LookupCrossCompilingEmulator( - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge) -{ - for(std::set<cmGeneratorTarget*>::const_iterator ci = - cge->GetTargets().begin(); - ci != cge->GetTargets().end(); ++ci) - { - cmGeneratorTarget* target = (*ci); - const char* emulator = target->GetProperty("CROSSCOMPILING_EMULATOR"); - if (emulator != 0) - { - return emulator; - } - } - return 0; -} - -//---------------------------------------------------------------------------- -bool cmCustomCommandGenerator::UseCrossCompilingEmulator(unsigned int c) const -{ - std::string const& argv0 = this->CC.GetCommandLines()[c][0]; - cmGeneratorTarget* target = - this->LG->FindGeneratorTargetToUse(argv0); - if(target && target->GetType() == cmState::EXECUTABLE) - { - return target->GetProperty("CROSSCOMPILING_EMULATOR") != 0; - } - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = this->GE->Parse(argv0); - cge->Evaluate(this->LG, this->Config); - return LookupCrossCompilingEmulator(cge) != 0; -} - -//---------------------------------------------------------------------------- std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const { std::string const& argv0 = this->CC.GetCommandLines()[c][0]; @@ -83,25 +50,7 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const { return target->GetLocation(this->Config); } - if (target && target->GetType() == cmState::EXECUTABLE) - { - const char* emulator = target->GetProperty("CROSSCOMPILING_EMULATOR"); - if (emulator) - { - return std::string(emulator); - } - } - - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = this->GE->Parse(argv0); - std::string exe = cge->Evaluate(this->LG, this->Config); - - const char* emulator = LookupCrossCompilingEmulator(cge); - if (emulator) - { - return std::string(emulator); - } - - return exe; + return this->GE->Parse(argv0)->Evaluate(this->LG, this->Config); } //---------------------------------------------------------------------------- @@ -138,13 +87,8 @@ void cmCustomCommandGenerator ::AppendArguments(unsigned int c, std::string& cmd) const { - unsigned int offset = 1; - if (this->UseCrossCompilingEmulator(c)) - { - offset = 0; - } cmCustomCommandLine const& commandLine = this->CC.GetCommandLines()[c]; - for(unsigned int j=offset;j < commandLine.size(); ++j) + for(unsigned int j=1;j < commandLine.size(); ++j) { std::string arg = this->GE->Parse(commandLine[j])->Evaluate(this->LG, diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h index 65ce031..a637fed 100644 --- a/Source/cmCustomCommandGenerator.h +++ b/Source/cmCustomCommandGenerator.h @@ -36,7 +36,6 @@ public: cmCustomCommand const& GetCC() const { return this->CC; } unsigned int GetNumberOfCommands() const; std::string GetCommand(unsigned int c) const; - bool UseCrossCompilingEmulator(unsigned int c) const; void AppendArguments(unsigned int c, std::string& cmd) const; const char* GetComment() const; std::string GetWorkingDirectory() const; diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index d16e5e7..02e14e6 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -289,10 +289,8 @@ if(CMake_TEST_FindMatlab) endif() add_executable(pseudo_emulator pseudo_emulator.c) -add_executable(pseudo_emulator_custom_command pseudo_emulator_custom_command.c) add_RunCMake_test(CrosscompilingEmulator - -DPSEUDO_EMULATOR=$<TARGET_FILE:pseudo_emulator> - -DPSEUDO_EMULATOR_CUSTOM_COMMAND=$<TARGET_FILE:pseudo_emulator_custom_command>) + -DPSEUDO_EMULATOR=$<TARGET_FILE:pseudo_emulator>) # Xcode 2.x forgets to create the output directory before linking # the individual architectures. if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") @@ -300,10 +298,6 @@ if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]" TARGET pseudo_emulator PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" ) - add_custom_command( - TARGET pseudo_emulator_custom_command - PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" - ) endif() if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand-build-check.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand-build-check.cmake deleted file mode 100644 index e10b161..0000000 --- a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand-build-check.cmake +++ /dev/null @@ -1,5 +0,0 @@ -foreach(output IN ITEMS output1 output2 output3 output4) - if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/${output}") - message(FATAL_ERROR "Failed to create output: ${RunCMake_TEST_BINARY_DIR}/${output}") - endif() -endforeach() diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake deleted file mode 100644 index 626653e..0000000 --- a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake +++ /dev/null @@ -1,36 +0,0 @@ -set(CMAKE_CROSSCOMPILING 1) - -# Executable: Return error code different from 0 -add_executable(generated_exe simple_src.cxx) - -# DoesNotUseEmulator -add_custom_command(OUTPUT output1 - COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/output1) - -# DoesNotUseEmulator: The command will fail if emulator is prepended -add_custom_command(OUTPUT output2 - COMMAND ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:generated_exe>" - COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/output2 - DEPENDS generated_exe) - -# UsesEmulator: The command only succeeds if the emulator is prepended -# to the command. -add_custom_command(OUTPUT output3 - COMMAND $<TARGET_FILE:generated_exe> - COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/output3 - DEPENDS generated_exe) - -# UsesEmulator: The command only succeeds if the emulator is prepended -# to the command. -add_custom_command(OUTPUT output4 - COMMAND generated_exe - COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/output4 - DEPENDS generated_exe) - -add_custom_target(ensure_build ALL - SOURCES - ${CMAKE_CURRENT_BINARY_DIR}/output1 - ${CMAKE_CURRENT_BINARY_DIR}/output2 - ${CMAKE_CURRENT_BINARY_DIR}/output3 - ${CMAKE_CURRENT_BINARY_DIR}/output4 -) diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddCustomTarget-build-check.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddCustomTarget-build-check.cmake deleted file mode 100644 index c621922..0000000 --- a/Tests/RunCMake/CrosscompilingEmulator/AddCustomTarget-build-check.cmake +++ /dev/null @@ -1 +0,0 @@ -include(${CMAKE_CURRENT_LIST_DIR}/AddCustomCommand-build-check.cmake) diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddCustomTarget.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddCustomTarget.cmake deleted file mode 100644 index cea2fa0..0000000 --- a/Tests/RunCMake/CrosscompilingEmulator/AddCustomTarget.cmake +++ /dev/null @@ -1,28 +0,0 @@ -set(CMAKE_CROSSCOMPILING 1) - -# Executable: Return error code different from 0 -add_executable(generated_exe simple_src.cxx) - -# DoesNotUseEmulator -add_custom_target(generate_output1 ALL - ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/output1) - -# DoesNotUseEmulator: The command will fail if emulator is prepended -add_custom_target(generate_output2 ALL - ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:generated_exe>" - COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/output2 - DEPENDS generated_exe) - -# UsesEmulator: The command only succeeds if the emulator is prepended -# to the command. -add_custom_target(generate_output3 ALL - $<TARGET_FILE:generated_exe> - COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/output3 - DEPENDS generated_exe) - -# UsesEmulator: The command only succeeds if the emulator is prepended -# to the command. -add_custom_target(generate_output4 ALL - generated_exe - COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/output4 - DEPENDS generated_exe) diff --git a/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake b/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake index 71aaad1..2581cfc 100644 --- a/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake +++ b/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake @@ -6,18 +6,3 @@ set(RunCMake_TEST_OPTIONS run_cmake(CrosscompilingEmulatorProperty) run_cmake(TryRun) run_cmake(AddTest) - -function(CustomCommandGenerator_run_and_build case) - # Use a single build tree for a few tests without cleaning. - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build) - set(RunCMake_TEST_NO_CLEAN 1) - set(RunCMake_TEST_OPTIONS - "-DCMAKE_CROSSCOMPILING_EMULATOR=${PSEUDO_EMULATOR_CUSTOM_COMMAND}") - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") - file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - run_cmake(${case}) - run_cmake_command(${case}-build ${CMAKE_COMMAND} --build .) -endfunction() - -CustomCommandGenerator_run_and_build(AddCustomCommand) -CustomCommandGenerator_run_and_build(AddCustomTarget) diff --git a/Tests/RunCMake/pseudo_emulator_custom_command.c b/Tests/RunCMake/pseudo_emulator_custom_command.c deleted file mode 100644 index 8b2b632..0000000 --- a/Tests/RunCMake/pseudo_emulator_custom_command.c +++ /dev/null @@ -1,26 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -// Usage: -// -// /path/to/program arg1 [arg2 [...]] -// -// Return EXIT_SUCCESS if 'generated_exe' string was found in <arg1> - -int main(int argc, char * argv[] ) -{ - const char* substring = "generated_exe"; - const char* string = 0; - if (argc < 2) - { - return EXIT_FAILURE; - } - string = argv[1]; - if (strstr(string, substring) != 0) - { - return EXIT_SUCCESS; - } - fprintf(stderr, "Failed to find string '%s' in '%s'\n", substring, string); - return EXIT_FAILURE; -} ----------------------------------------------------------------------- Summary of changes: Help/command/add_custom_command.rst | 4 +- Help/command/add_custom_target.rst | 4 +- Help/prop_tgt/CROSSCOMPILING_EMULATOR.rst | 4 +- Source/cmCustomCommandGenerator.cxx | 60 +------------------- Source/cmCustomCommandGenerator.h | 1 - Tests/RunCMake/CMakeLists.txt | 8 +-- .../AddCustomCommand-build-check.cmake | 5 -- .../CrosscompilingEmulator/AddCustomCommand.cmake | 36 ------------ .../AddCustomTarget-build-check.cmake | 1 - .../CrosscompilingEmulator/AddCustomTarget.cmake | 28 --------- .../CrosscompilingEmulator/RunCMakeTest.cmake | 15 ----- Tests/RunCMake/pseudo_emulator_custom_command.c | 26 --------- 12 files changed, 7 insertions(+), 185 deletions(-) delete mode 100644 Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand-build-check.cmake delete mode 100644 Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake delete mode 100644 Tests/RunCMake/CrosscompilingEmulator/AddCustomTarget-build-check.cmake delete mode 100644 Tests/RunCMake/CrosscompilingEmulator/AddCustomTarget.cmake delete mode 100644 Tests/RunCMake/pseudo_emulator_custom_command.c hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits